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

fix(golint): fixing golint warnings #133

Merged
merged 6 commits into from
Jun 9, 2020

Conversation

Icedroid
Copy link
Contributor

  • fix code by golint warning

Signed-off-by: wiwen <shenggxhz@gmail.com>
pkg/zfs/zfs_util.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pawanpraka1 pawanpraka1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @Icedroid. There are some fmt changes you need to push to this PR. You will get those files when you run make command.

@pawanpraka1
Copy link
Contributor

pawanpraka1 commented May 27, 2020

@Icedroid can you run make format in repo directory. it will format/align the code. After this you can check the git status to get the list of modified files. Please push those files in this PR. If you have already run make in the repo directory, it will run format by default and you might already have those files unstaged. You just have to add them, commit them and push them.

Signed-off-by: wiwen <shenggxhz@gmail.com>
@Icedroid
Copy link
Contributor Author

Icedroid commented May 27, 2020

I run make in my mac is failed.

❯ make
--> Running go fmt
--> Running go test
# github.com/openebs/zfs-localpv/pkg/driver
pkg/driver/agent.go:342:32: invalid operation: int64(sfs.Blocks) * sfs.Bsize (mismatched types int64 and uint32)
pkg/driver/agent.go:343:42: invalid operation: int64(sfs.Blocks - sfs.Bfree) * sfs.Bsize (mismatched types int64 and uint32)
pkg/driver/agent.go:344:32: invalid operation: int64(sfs.Bavail) * sfs.Bsize (mismatched types int64 and uint32)
ok      github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1  1.512s
ok      github.com/openebs/zfs-localpv/pkg/common/kubernetes/client     2.571s
ok      github.com/openebs/zfs-localpv/pkg/usage        1.718s
make: *** [test] Error 1

Signed-off-by: wiwen <shenggxhz@gmail.com>
Signed-off-by: wiwen <shenggxhz@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented May 27, 2020

Codecov Report

Merging #133 into master will decrease coverage by 0.06%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
- Coverage   22.71%   22.65%   -0.07%     
==========================================
  Files          14       14              
  Lines         493      490       -3     
==========================================
- Hits          112      111       -1     
+ Misses        380      378       -2     
  Partials        1        1              
Impacted Files Coverage Δ
pkg/client/k8s/v1alpha1/namespace.go 0.00% <0.00%> (ø)
pkg/common/kubernetes/client/client.go 83.33% <ø> (ø)
pkg/usage/googleanalytics.go 0.00% <ø> (ø)
pkg/usage/usage.go 0.00% <ø> (ø)
pkg/usage/versionset.go 0.00% <ø> (ø)
pkg/usage/ping.go 40.00% <50.00%> (-3.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b08a1e2...d528722. Read the comment docs.

@pawanpraka1
Copy link
Contributor

@Icedroid if you have changed crd(comment or anything), then run make manifests to generate the crds as they are auto generated. So you need to do two things

  1. make format <==== for formatting
  2. make manifests <==== for crd changes

And add the unstaged files and push.

Also need a favor, can you raise a separate PR to help improve the contrubuting document. Please add the missing details so that no one else faces the same issue.

https://github.com/openebs/zfs-localpv/blob/master/CONTRIBUTING.md#pull-request-checklist

@pawanpraka1
Copy link
Contributor

@Icedroid There are still few linter errors, you want to take a look?

$ golint pkg/... tests/...
pkg/apis/openebs.io/zfs/v1alpha1/zfssnapshot.go:49:6: exported type SnapStatus should have comment or be unexported
pkg/apis/openebs.io/zfs/v1alpha1/zfsvolume.go:201:6: exported type VolStatus should have comment or be unexported
pkg/client/k8s/v1alpha1/clientset.go:32:18: exported func Clientset returns unexported type *v1alpha1.clientset, which can be annoying to use
pkg/client/k8s/v1alpha1/configmap.go:38:40: exported func ConfigMap returns unexported type *v1alpha1.configmap, which can be annoying to use
pkg/client/k8s/v1alpha1/dynamic.go:32:16: exported func Dynamic returns unexported type *v1alpha1.dynamic, which can be annoying to use
pkg/client/k8s/v1alpha1/namespace.go:37:18: exported func Namespace returns unexported type *v1alpha1.namespace, which can be annoying to use
pkg/client/k8s/v1alpha1/node.go:36:1: exported function Node should have comment or be unexported
pkg/client/k8s/v1alpha1/node.go:36:13: exported func Node returns unexported type *v1alpha1.node, which can be annoying to use
pkg/client/k8s/v1alpha1/node.go:45:9: if block ends with a return statement, so drop this else and outdent its block
pkg/client/k8s/v1alpha1/node.go:55:9: if block ends with a return statement, so drop this else and outdent its block
pkg/client/k8s/v1alpha1/node.go:66:9: if block ends with a return statement, so drop this else and outdent its block
pkg/client/k8s/v1alpha1/node.go:77:9: if block ends with a return statement, so drop this else and outdent its block
pkg/client/k8s/v1alpha1/node.go:88:9: if block ends with a return statement, so drop this else and outdent its block
pkg/client/k8s/v1alpha1/resource.go:80:66: exported func Resource returns unexported type *v1alpha1.resource, which can be annoying to use
pkg/usage/const.go:1:1: package comment should be of the form "Package usage ..."
pkg/usage/const.go:37:2: comment on exported const EventLabelNode should be of the form "EventLabelNode ..."
pkg/usage/const.go:39:2: exported const EventLabelCapacity should have comment (or a comment on this block) or be unexported
pkg/usage/versionset.go:48:19: exported func NewVersion returns unexported type *usage.versionSet, which can be annoying to use
pkg/zfs/xfs_util.go:72:6: func xfsGenerateUuid should be xfsGenerateUUID
pkg/zfs/zfs_util.go:29:2: don't use ALL_CAPS in Go names; use CamelCase
pkg/zfs/zfs_util.go:30:2: don't use ALL_CAPS in Go names; use CamelCase
pkg/zfs/zfs_util.go:47:2: don't use ALL_CAPS in Go names; use CamelCase
pkg/zfs/zfs_util.go:48:2: don't use ALL_CAPS in Go names; use CamelCase
tests/utils.go:22:2: should not use dot imports
tests/utils.go:23:2: should not use dot imports
tests/utils.go:175:1: exported function VerifyZFSVolume should have comment or be unexported
tests/utils.go:200:1: exported function VerifyZFSVolumePropEdit should have comment or be unexported
tests/pod/pod.go:27:6: type name will be used as pod.PodList by other packages, and that stutters; consider calling this List
tests/pvc/persistentvolumeclaim.go:33:6: type name will be used as pvc.PVCList by other packages, and that stutters; consider calling this List

@kmova kmova added this to RC1 - Due: Jun 5 2020 in 1.11 Release Tracker - Due June 15th. Jun 3, 2020
@kmova kmova moved this from RC1 - Due: Jun 5 2020 to Pushed to Next release due to WIP in 1.11 Release Tracker - Due June 15th. Jun 8, 2020
Copy link
Contributor

@pawanpraka1 pawanpraka1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. Will take care of remaining liniting errors in other PR. Please add a changelog.

@kmova kmova merged commit f5ae3ff into openebs:master Jun 9, 2020
1.11 Release Tracker - Due June 15th. automation moved this from Pushed to Next release due to WIP to Done Jun 9, 2020
@pawanpraka1 pawanpraka1 changed the title fix golint warning fix(golint): fixing golint warnings Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants