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

Go Modules #347

Merged
merged 8 commits into from
Oct 6, 2019
Merged

Go Modules #347

merged 8 commits into from
Oct 6, 2019

Conversation

paveg
Copy link
Contributor

@paveg paveg commented Sep 20, 2019

Overview

dep is old so let's migrate.
now, this PR is working in progress.

Please merge, if possible.

@paveg paveg changed the title [wip]Go Modules Go Modules Sep 20, 2019
@paveg
Copy link
Contributor Author

paveg commented Sep 21, 2019

This PR included gometalinter and go module changes, so it can be divided.
bacause, I'll change it to incleded only one changing.

@paveg paveg changed the title Go Modules [wip]Go Modules Sep 21, 2019
@paveg paveg changed the title [wip]Go Modules Go Modules Sep 21, 2019
# Gometalinter is deprecated and broken dependency so let's use with GO111MODULE=off
prepare.metalinter:
GO111MODULE=off go get -u github.com/alecthomas/gometalinter
GO111MODULE=off gometalinter --fast --install
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to installed into BIN_DIR , so go-i18n v2 is broken.

# GO111MODULE=auto
$ go get -u github.com/alecthomas/gometalinter
go: finding github.com/google/shlex latest
go: finding gopkg.in/alecthomas/kingpin.v3-unstable latest
go: finding github.com/alecthomas/units latest
build github.com/alecthomas/gometalinter: cannot load github.com/nicksnyder/go-i18n/i18n: module github.com/nicksnyder/go-i18n@latest (v2.0.2+incompatible) found, but does not contain package github.com/nicksnyder/go-i18n/i18n

and I executed requiring go-i18n@v1.10.1 but it was failed.

$ go mod edit -require github.com/nicksnyder/go-i18n@v1.10.1

~/src/github.com/Versent/saml2aws modules*
$ make prepare
GOBIN=/Users/ryota/src/github.com/Versent/saml2aws/bin go install github.com/buildkite/github-release
go: finding github.com/buildkite/github-release latest
go: finding golang.org/x/oauth2 latest
GOBIN=/Users/ryota/src/github.com/Versent/saml2aws/bin go install github.com/mitchellh/gox
GOBIN=/Users/ryota/src/github.com/Versent/saml2aws/bin go install github.com/axw/gocov/gocov
GOBIN=/Users/ryota/src/github.com/Versent/saml2aws/bin go install golang.org/x/tools/cmd/cover
GOBIN=/Users/ryota/src/github.com/Versent/saml2aws/bin go install github.com/alecthomas/gometalinter
go: finding gopkg.in/alecthomas/kingpin.v3-unstable latest
go: finding github.com/google/shlex latest
# github.com/alecthomas/gometalinter
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:36:94: cannot use loadConfig (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("config", "Load JSON configuration from file.").Envar("GOMETALINTER_CONFIG").Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:38:100: cannot use disableAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("disable", "Disable previously enabled linters.").PlaceHolder("LINTER").Short('D').Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:39:99: cannot use enableAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("enable", "Enable previously disabled linters.").PlaceHolder("LINTER").Short('E').Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:40:83: cannot use cliLinterOverrides (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("linter", "Define a linter.").PlaceHolder("NAME:COMMAND:PATTERN").Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:43:56: cannot use disableAllAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("disable-all", "Disable all linters.").Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:44:54: cannot use enableAllAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("enable-all", "Enable all linters.").Action
../../../../pkg/mod/github.com/alecthomas/gometalinter@v3.0.0+incompatible/main.go:200:12: cannot use loadDefaultConfig (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.Action
make: *** [prepare] Error 2

differences is below:

$ git diff
diff --git a/Makefile b/Makefile
index 4cdb3bc..d47d863 100644
--- a/Makefile
+++ b/Makefile
@@ -11,16 +11,12 @@ BIN_DIR := $(CURDIR)/bin

 ci: prepare test

-prepare: prepare.metalinter
+prepare:
        GOBIN=$(BIN_DIR) go install github.com/buildkite/github-release
        GOBIN=$(BIN_DIR) go install github.com/mitchellh/gox
        GOBIN=$(BIN_DIR) go install github.com/axw/gocov/gocov
        GOBIN=$(BIN_DIR) go install golang.org/x/tools/cmd/cover
-
-# Gometalinter is deprecated and broken dependency so let's use with GO111MODULE=off
-prepare.metalinter:
-       GO111MODULE=off go get -u github.com/alecthomas/gometalinter
-       GO111MODULE=off gometalinter --fast --install
+       GOBIN=$(BIN_DIR) go install github.com/alecthomas/gometalinter

 mod:
        @go mod download
@@ -39,7 +35,7 @@ compile: mod

 # Run all the linters
 lint:
-       @gometalinter --vendor ./...
+       @$(BIN_DIR)/gometalinter --vendor ./...

 # gofmt and goimports all go files
 fmt:
@@ -78,4 +74,4 @@ packages:
 generate-mocks:
        mockery -dir pkg/prompter --all

-.PHONY: default prepare.metalinter prepare mod compile lint fmt dist release test clean generate-mocks
+.PHONY: default prepare mod compile lint fmt dist release test clean generate-mocks

@wolfeidau wolfeidau merged commit 6632773 into Versent:master Oct 6, 2019
@paveg paveg deleted the modules branch October 8, 2019 07:22
@quintok quintok mentioned this pull request Nov 7, 2019
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 this pull request may close these issues.

2 participants