Skip to content

Fix remaining go vet warnings (oauth struct tag, unreachable code) #405

@wilke

Description

@wilke

Summary

Three pre-existing go vet warnings remain after the cleanup in PR #402. These are non-blocking (no runtime impact) but should be fixed for code quality.

1. shock-server/auth/oauth/oauth.go:23 — unexported field with json tag

type resErr struct {
    error string `json:"error"`
}

The field error is unexported (lowercase), so encoding/json will never marshal or unmarshal it. The json:"error" tag has no effect.

Fix: Either export the field (Error string \json:"error"``) or remove the json tag if it's only used internally.

2. shock-server/request/request.go:279 — unreachable code

The ParseMultipartForm function contains an infinite for {} loop (line 127) that only exits via return statements inside the loop body (line 141 on EOF/error, and various error returns in the loop body). The return at line 279 after the loop closing brace is unreachable.

Fix: Remove the unreachable return on line 279. The function's named return values are already returned by the in-loop return statements.

3. shock-server/reload.go:39 — unreachable code

The reload() function has an if/else where both branches end with return statements (line 26 for URL source, line 37 for directory source). The return on line 39 after the closing } of the else block is unreachable.

Fix: Remove the unreachable return on line 39.

Verification

After fixes, confirm with:

go vet -mod=vendor ./shock-server/... ./shock-client/...

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions