mattermost-community / mattermost-plugin-agenda

Mattermost plugin to handle meeting agendas
Apache License 2.0
34 stars 21 forks source link

Integrate GolangCI-Lint #43

Closed hanzei closed 4 years ago

hanzei commented 4 years ago

Mattermost is currently in the process of using golangci-lint as the default linter for all go projects. https://github.com/mattermost/mattermost-plugin-autolink/pull/108 serves as an example of how the migration should look like:

  1. Copy .golangci.yml from https://github.com/mattermost/mattermost-plugin-autolink/ into this repository.
  2. Copy Makefile from https://github.com/mattermost/mattermost-plugin-autolink/ into this repository.
  3. Copy build/ from https://github.com/mattermost/mattermost-plugin-autolink/ into this repository.
  4. Run go mod tidy and make dist to ensure the build system works fine.
  5. Update linters-settings.goimports.local-prefixes to the go module path i.e. to github.com/mattermost/mattermost-plugin-aws-SNS.
  6. Run make golangci-lint and fix all issues that arise.

Fixing an linter issue is sometimes trivial but can also be quite complicated. There might be cases, where ignoring an issue using issues.exclude-rules is needed. If you don't know how to resolve an error, please reach out to @hanzei on the Mattermost Community Server or ask the question here.

AugustasV commented 4 years ago

I would like to work on this issue!

hanzei commented 4 years ago

Awesome, thanks @AugustasV :tada:

AugustasV commented 4 years ago

Couldn't successfully run make dist command: namai@solydx:~/mattermost/mattermost-plugin-agenda$ make dist./build/bin/manifest apply mkdir -p server/dist; cd server && env GOOS=linux GOARCH=amd64 /usr/local/go/bin/go build -o dist/plugin-linux-amd64; ../../../go/pkg/mod/github.com/mattermost/mattermost-server@v5.11.1+incompatible/plugin/hclog_adapter.go:86:2: cannot use h (type *hclogAdapter) as type hclog.Logger in return argument: *hclogAdapter does not implement hclog.Logger (missing ImpliedArgs method) ../../../go/pkg/mod/github.com/mattermost/mattermost-server@v5.11.1+incompatible/plugin/hclog_adapter.go:90:2: cannot use h (type *hclogAdapter) as type hclog.Logger in return argument: *hclogAdapter does not implement hclog.Logger (missing ImpliedArgs method) ../../../go/pkg/mod/github.com/mattermost/mattermost-server@v5.11.1+incompatible/plugin/hclog_adapter.go:94:2: cannot use h (type *hclogAdapter) as type hclog.Logger in return argument: *hclogAdapter does not implement hclog.Logger (missing ImpliedArgs method) ../../../go/pkg/mod/github.com/mattermost/mattermost-server@v5.11.1+incompatible/plugin/supervisor.go:62:3: cannot use hclogAdaptedLogger (type *hclogAdapter) as type hclog.Logger in field value: *hclogAdapter does not implement hclog.Logger (missing ImpliedArgs method) make: *** [Makefile:58: server] Error 2 How could I solve this issue? on mattermost-plugin-google-calendar repo everything worked fine.

hanzei commented 4 years ago

@AugustasV Is it possible that you are not using the latest master of this plugin?

AugustasV commented 4 years ago

@hanzei it's not the case, merged latest master but problem still persist.

hanzei commented 4 years ago

Could you please push a WIP PR so I can take a look?

AugustasV commented 4 years ago

Made pull request, but now this error: ./command.go:141:32: p.MattermostPlugin.API.SearchPostsInTeamForUser undefined (type "github.com/mattermost/mattermost-server/v5/plugin".API has no field or method SearchPostsInTeamForUser) make: *** [Makefile:58: server] Error 2

If I try same steps on fresh cloned repo, I got npm build errors: ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals' Require stack:

hanzei commented 4 years ago

Hey @AugustasV, thanks for reaching out! Please see my comment in the PR: https://github.com/mattermost/mattermost-plugin-agenda/pull/48#issuecomment-652261791