Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lint failure #72

Closed
andyzhangx opened this issue Nov 26, 2021 · 2 comments · Fixed by #90
Closed

golangci-lint failure #72

andyzhangx opened this issue Nov 26, 2021 · 2 comments · Fixed by #90

Comments

@andyzhangx
Copy link
Member

https://github.com/kubernetes-csi/csi-driver-iscsi/runs/4329568959?check_suite_focus=true

run golangci-lint
  Running [/home/runner/golangci-lint-1.29.0-linux-amd64/golangci-lint run --out-format=github-actions -E=gofmt,golint,misspell --timeout=30m0s] in [] ...
  Error: Error return value of `iscsiLib.Disconnect` is not checked (errcheck)
  Error: Error return value of `server.Serve` is not checked (errcheck)
  Error: Error return value of `flag.Set` is not checked (errcheck)
  Error: Error return value of `flag.CommandLine.Parse` is not checked (errcheck)
  Error: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
  Error: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
  Error: exported func NewDriver returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.driver, which can be annoying to use (golint)
  Error: exported func NewNodeServer returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.nodeServer, which can be annoying to use (golint)
  Error: type name will be used as iscsi.ISCSIUtil by other packages, and that stutters; consider calling this Util (golint)
  Error: `ns` is unused (structcheck)
  Error: S1023: redundant `return` statement (gosimple)
  Error: S1023: redundant `return` statement (gosimple)
  
  Error: issues found
  Ran golangci-lint in 109779ms
@andyzhangx
Copy link
Member Author

name: Static Checks
on:
    pull_request: {}
    push: {}
jobs:
    go_lint:
        name: Go Lint
        runs-on: ubuntu-18.04
        steps:
            - name: Checkout code
              uses: actions/checkout@master
            - name: Run linter
              uses: golangci/golangci-lint-action@v2
              with:
                  version: v1.29
                  args: -E=gofmt,golint,misspell --timeout=30m0s

@andyzhangx
Copy link
Member Author

~/go/src/github.com/kubernetes-csi/csi-driver-iscsi# hack/verify-golint.sh
Verifying golint
pkg/iscsi/driver.go:31:2: `ns` is unused (structcheck)
        ns *nodeServer
        ^
pkg/iscsi/iscsi_util.go:112:21: Error return value of `iscsiLib.Disconnect` is not checked (errcheck)
        iscsiLib.Disconnect(connector.TargetIqn, connector.TargetPortals)
                           ^
pkg/iscsi/server.go:110:14: Error return value of `server.Serve` is not checked (errcheck)
        server.Serve(listener)
                    ^
cmd/iscsiplugin/main.go:36:10: Error return value of `flag.Set` is not checked (errcheck)
        flag.Set("logtostderr", "true")
                ^
cmd/iscsiplugin/main.go:41:24: Error return value of `flag.CommandLine.Parse` is not checked (errcheck)
        flag.CommandLine.Parse([]string{})
                              ^
cmd/iscsiplugin/main.go:56:32: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
        cmd.MarkPersistentFlagRequired("nodeid")
                                      ^
cmd/iscsiplugin/main.go:59:32: Error return value of `cmd.MarkPersistentFlagRequired` is not checked (errcheck)
        cmd.MarkPersistentFlagRequired("endpoint")
                                      ^
pkg/iscsi/driver.go:45:41: exported func NewDriver returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.driver, which can be annoying to use (golint)
func NewDriver(nodeID, endpoint string) *driver {
                                        ^
pkg/iscsi/driver.go:64:31: exported func NewNodeServer returns unexported type *github.com/kubernetes-csi/csi-driver-iscsi/pkg/iscsi.nodeServer, which can be annoying to use (golint)
func NewNodeServer(d *driver) *nodeServer {
                              ^
pkg/iscsi/iscsi_util.go:29:6: type name will be used as iscsi.ISCSIUtil by other packages, and that stutters; consider calling this Util (golint)
type ISCSIUtil struct{}
     ^
pkg/iscsi/driver.go:101:2: S1023: redundant `return` statement (gosimple)
        return
        ^
pkg/iscsi/server.go:58:2: S1023: redundant `return` statement (gosimple)
        return
        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant