Просмотр исходного кода

Add support for GO111MODULE

tags/v0.13^2
9seconds 7 лет назад
Родитель
Сommit
0828bd85ad
5 измененных файлов: 68 добавлений и 234 удалений
  1. 0
    154
      Gopkg.lock
  2. 0
    58
      Gopkg.toml
  3. 19
    22
      Makefile
  4. 19
    0
      go.mod
  5. 30
    0
      go.sum

+ 0
- 154
Gopkg.lock Просмотреть файл

@@ -1,154 +0,0 @@
1
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
2
-
3
-
4
-[[projects]]
5
-  branch = "master"
6
-  digest = "1:315c5f2f60c76d89b871c73f9bd5fe689cad96597afd50fb9992228ef80bdd34"
7
-  name = "github.com/alecthomas/template"
8
-  packages = [
9
-    ".",
10
-    "parse",
11
-  ]
12
-  pruneopts = "UT"
13
-  revision = "a0175ee3bccc567396460bf5acd36800cb10c49c"
14
-
15
-[[projects]]
16
-  branch = "master"
17
-  digest = "1:c198fdc381e898e8fb62b8eb62758195091c313ad18e52a3067366e1dda2fb3c"
18
-  name = "github.com/alecthomas/units"
19
-  packages = ["."]
20
-  pruneopts = "UT"
21
-  revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
22
-
23
-[[projects]]
24
-  digest = "1:a8d622a8049a4aa420e1c509873bb85d4c45c5107f420d922f919bfcb8d08694"
25
-  name = "github.com/beevik/ntp"
26
-  packages = ["."]
27
-  pruneopts = "UT"
28
-  revision = "62c80a04de2086884d8296004b6d74ee1846c582"
29
-  version = "v0.2.0"
30
-
31
-[[projects]]
32
-  digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
33
-  name = "github.com/davecgh/go-spew"
34
-  packages = ["spew"]
35
-  pruneopts = "UT"
36
-  revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
37
-  version = "v1.1.1"
38
-
39
-[[projects]]
40
-  branch = "master"
41
-  digest = "1:6f9339c912bbdda81302633ad7e99a28dfa5a639c864061f1929510a9a64aa74"
42
-  name = "github.com/dustin/go-humanize"
43
-  packages = ["."]
44
-  pruneopts = "UT"
45
-  revision = "9f541cc9db5d55bce703bd99987c9d5cb8eea45e"
46
-
47
-[[projects]]
48
-  branch = "master"
49
-  digest = "1:1261ccace00babbf02bb702e71c85c8e81f65bad7bdb98c12c7a409c14de1d86"
50
-  name = "github.com/juju/errors"
51
-  packages = ["."]
52
-  pruneopts = "UT"
53
-  revision = "22422dad46e14561a0854ad42497a75af9b61909"
54
-
55
-[[projects]]
56
-  digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
57
-  name = "github.com/pmezard/go-difflib"
58
-  packages = ["difflib"]
59
-  pruneopts = "UT"
60
-  revision = "792786c7400a136282c1664665ae0a8db921c6c2"
61
-  version = "v1.0.0"
62
-
63
-[[projects]]
64
-  digest = "1:274f67cb6fed9588ea2521ecdac05a6d62a8c51c074c1fccc6a49a40ba80e925"
65
-  name = "github.com/satori/go.uuid"
66
-  packages = ["."]
67
-  pruneopts = "UT"
68
-  revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
69
-  version = "v1.2.0"
70
-
71
-[[projects]]
72
-  digest = "1:18752d0b95816a1b777505a97f71c7467a8445b8ffb55631a7bf779f6ba4fa83"
73
-  name = "github.com/stretchr/testify"
74
-  packages = ["assert"]
75
-  pruneopts = "UT"
76
-  revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
77
-  version = "v1.2.2"
78
-
79
-[[projects]]
80
-  digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d"
81
-  name = "go.uber.org/atomic"
82
-  packages = ["."]
83
-  pruneopts = "UT"
84
-  revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289"
85
-  version = "v1.3.2"
86
-
87
-[[projects]]
88
-  digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a"
89
-  name = "go.uber.org/multierr"
90
-  packages = ["."]
91
-  pruneopts = "UT"
92
-  revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a"
93
-  version = "v1.1.0"
94
-
95
-[[projects]]
96
-  digest = "1:c52caf7bd44f92e54627a31b85baf06a68333a196b3d8d241480a774733dcf8b"
97
-  name = "go.uber.org/zap"
98
-  packages = [
99
-    ".",
100
-    "buffer",
101
-    "internal/bufferpool",
102
-    "internal/color",
103
-    "internal/exit",
104
-    "zapcore",
105
-  ]
106
-  pruneopts = "UT"
107
-  revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982"
108
-  version = "v1.9.1"
109
-
110
-[[projects]]
111
-  branch = "master"
112
-  digest = "1:937d8f64b118c494c48b0cc9c990f2163c7483e6c70b5828f20006d81c61412f"
113
-  name = "golang.org/x/net"
114
-  packages = [
115
-    "bpf",
116
-    "internal/iana",
117
-    "internal/socket",
118
-    "ipv4",
119
-  ]
120
-  pruneopts = "UT"
121
-  revision = "2f5d2388922f370f4355f327fcf4cfe9f5583908"
122
-
123
-[[projects]]
124
-  digest = "1:c06d9e11d955af78ac3bbb26bd02e01d2f61f689e1a3bce2ef6fb683ef8a7f2d"
125
-  name = "gopkg.in/alecthomas/kingpin.v2"
126
-  packages = ["."]
127
-  pruneopts = "UT"
128
-  revision = "947dcec5ba9c011838740e680966fd7087a71d0d"
129
-  version = "v2.2.6"
130
-
131
-[[projects]]
132
-  digest = "1:38b469493eb173db9c03321d64adcad4c7991ea0a19b5edc5bdc094f0e8c7384"
133
-  name = "gopkg.in/alexcesaro/statsd.v2"
134
-  packages = ["."]
135
-  pruneopts = "UT"
136
-  revision = "7fea3f0d2fab1ad973e641e51dba45443a311a90"
137
-  version = "v2.0.0"
138
-
139
-[solve-meta]
140
-  analyzer-name = "dep"
141
-  analyzer-version = 1
142
-  input-imports = [
143
-    "github.com/beevik/ntp",
144
-    "github.com/dustin/go-humanize",
145
-    "github.com/juju/errors",
146
-    "github.com/satori/go.uuid",
147
-    "github.com/stretchr/testify/assert",
148
-    "go.uber.org/zap",
149
-    "go.uber.org/zap/zapcore",
150
-    "gopkg.in/alecthomas/kingpin.v2",
151
-    "gopkg.in/alexcesaro/statsd.v2",
152
-  ]
153
-  solver-name = "gps-cdcl"
154
-  solver-version = 1

+ 0
- 58
Gopkg.toml Просмотреть файл

@@ -1,58 +0,0 @@
1
-# Gopkg.toml example
2
-#
3
-# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
4
-# for detailed Gopkg.toml documentation.
5
-#
6
-# required = ["github.com/user/thing/cmd/thing"]
7
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8
-#
9
-# [[constraint]]
10
-#   name = "github.com/user/project"
11
-#   version = "1.0.0"
12
-#
13
-# [[constraint]]
14
-#   name = "github.com/user/project2"
15
-#   branch = "dev"
16
-#   source = "github.com/myfork/project2"
17
-#
18
-# [[override]]
19
-#   name = "github.com/x/y"
20
-#   version = "2.4.0"
21
-#
22
-# [prune]
23
-#   non-go = false
24
-#   go-tests = true
25
-#   unused-packages = true
26
-
27
-
28
-[prune]
29
-  go-tests = true
30
-  unused-packages = true
31
-
32
-[[constraint]]
33
-  name = "gopkg.in/alecthomas/kingpin.v2"
34
-  version = "2.2.6"
35
-
36
-[[constraint]]
37
-  branch = "master"
38
-  name = "github.com/juju/errors"
39
-
40
-[[constraint]]
41
-  name = "github.com/stretchr/testify"
42
-  version = "1.2.1"
43
-
44
-[[constraint]]
45
-  name = "github.com/satori/go.uuid"
46
-  version = "1.2.0"
47
-
48
-[[constraint]]
49
-  branch = "master"
50
-  name = "github.com/dustin/go-humanize"
51
-
52
-[[constraint]]
53
-  name = "github.com/beevik/ntp"
54
-  version = "0.2.0"
55
-
56
-[[constraint]]
57
-  name = "gopkg.in/alexcesaro/statsd.v2"
58
-  version = "2.0.0"

+ 19
- 22
Makefile Просмотреть файл

@@ -2,26 +2,28 @@ ROOT_DIR     := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2 2
 IMAGE_NAME   := mtg
3 3
 APP_NAME     := $(IMAGE_NAME)
4 4
 
5
-VENDOR_FILES := $(shell find "$(ROOT_DIR)/vendor" 2>/dev/null || echo -n "vendor")
6 5
 CC_BINARIES  := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}")
7
-APP_DEPS     := version.go $(VENDOR_FILES)
6
+APP_DEPS     := version.go
8 7
 
9 8
 GOLANGCI_LINT_VERSION := v1.10.2
10 9
 
11 10
 COMMON_BUILD_FLAGS := -ldflags="-s -w"
12 11
 
12
+MOD_ON  := env GO111MODULE=on
13
+MOD_OFF := env GO111MODULE=auto
14
+
13 15
 # -----------------------------------------------------------------------------
14 16
 
15 17
 $(APP_NAME): $(APP_DEPS)
16
-	@go build $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
18
+	@$(MOD_ON) go build $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
17 19
 
18 20
 static-$(APP_NAME): $(APP_DEPS)
19
-	@env CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
21
+	@$(MOD_ON) env CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
20 22
 
21 23
 $(APP_NAME)-%: GOOS=$(shell echo -n "$@" | sed 's?$(APP_NAME)-??' | cut -f1 -d-)
22 24
 $(APP_NAME)-%: GOARCH=$(shell echo -n "$@" | sed 's?$(APP_NAME)-??' | cut -f2 -d-)
23 25
 $(APP_NAME)-%: $(APP_DEPS) ccbuilds
24
-	@env "GOOS=$(GOOS)" "GOARCH=$(GOARCH)" \
26
+	@$(MOD_ON) env "GOOS=$(GOOS)" "GOARCH=$(GOARCH)" \
25 27
 		go build \
26 28
 		$(COMMON_BUILD_FLAGS) \
27 29
 		-o "./ccbuilds/$(APP_NAME)-$(GOOS)-$(GOARCH)"
@@ -30,10 +32,10 @@ ccbuilds:
30 32
 	@rm -rf ./ccbuilds && mkdir -p ./ccbuilds
31 33
 
32 34
 version.go:
33
-	@go generate main.go
35
+	@$(MOD_ON) go generate main.go
34 36
 
35
-vendor: Gopkg.lock Gopkg.toml
36
-	@dep ensure --vendor-only
37
+vendor: go.mod go.sum
38
+	@$(MOD_ON) go mod vendor
37 39
 
38 40
 # -----------------------------------------------------------------------------
39 41
 
@@ -51,16 +53,16 @@ crosscompile-dir:
51 53
 	@rm -rf "$(CC_DIR)" && mkdir -p "$(CC_DIR)"
52 54
 
53 55
 .PHONY: test
54
-test: vendor version.go
55
-	@go test -v ./...
56
+test: vendor $(APP_DEPS)
57
+	@$(MOD_ON) go test -v ./...
56 58
 
57 59
 .PHONY: lint
58
-lint: version.go
59
-	@golangci-lint run
60
+lint: vendor $(APP_DEPS)
61
+	@$(MOD_OFF) golangci-lint run
60 62
 
61 63
 .PHONY: critic
62
-critic: version.go
63
-	@gocritic check-project "$(ROOT_DIR)"
64
+critic: vendor $(APP_DEPS)
65
+	@$(MOD_OFF) gocritic check-project "$(ROOT_DIR)"
64 66
 
65 67
 .PHONY: clean
66 68
 clean:
@@ -73,18 +75,13 @@ docker:
73 75
 	@docker build --pull -t "$(IMAGE_NAME)" "$(ROOT_DIR)"
74 76
 
75 77
 .PHONY: prepare
76
-prepare: install-dep install-lint install-critic
77
-	@dep ensure --vendor-only
78
-
79
-.PHONY: install-dep
80
-install-dep:
81
-	@go get -u github.com/golang/dep/cmd/dep
78
+prepare: install-lint install-critic
82 79
 
83 80
 .PHONY: install-lint
84 81
 install-lint:
85 82
 	@curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh \
86
-		| bash -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
83
+		| $(MOD_OFF) bash -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
87 84
 
88 85
 .PHONY: install-critic
89 86
 install-critic:
90
-	@go get -u github.com/go-critic/go-critic/...
87
+	@$(MOD_OFF) go get -u github.com/go-critic/go-critic/...

+ 19
- 0
go.mod Просмотреть файл

@@ -0,0 +1,19 @@
1
+module github.com/9seconds/mtg
2
+
3
+require (
4
+	github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
5
+	github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
6
+	github.com/beevik/ntp v0.2.0
7
+	github.com/davecgh/go-spew v1.1.1 // indirect
8
+	github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d
9
+	github.com/juju/errors v0.0.0-20180806074554-22422dad46e1
10
+	github.com/pmezard/go-difflib v1.0.0 // indirect
11
+	github.com/satori/go.uuid v1.2.0
12
+	github.com/stretchr/testify v1.2.2
13
+	go.uber.org/atomic v1.3.2 // indirect
14
+	go.uber.org/multierr v1.1.0 // indirect
15
+	go.uber.org/zap v1.9.1
16
+	golang.org/x/net v0.0.0-20180921000356-2f5d2388922f // indirect
17
+	gopkg.in/alecthomas/kingpin.v2 v2.2.6
18
+	gopkg.in/alexcesaro/statsd.v2 v2.0.0
19
+)

+ 30
- 0
go.sum Просмотреть файл

@@ -0,0 +1,30 @@
1
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
2
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
3
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
4
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
5
+github.com/beevik/ntp v0.2.0 h1:sGsd+kAXzT0bfVfzJfce04g+dSRfrs+tbQW8lweuYgw=
6
+github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg=
7
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
8
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9
+github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d h1:lDrio3iIdNb0Gw9CgH7cQF+iuB5mOOjdJ9ERNJCBgb4=
10
+github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
11
+github.com/juju/errors v0.0.0-20180806074554-22422dad46e1 h1:wnhMXidtb70kDZCeLt/EfsVtkXS5c8zLnE9y/6DIRAU=
12
+github.com/juju/errors v0.0.0-20180806074554-22422dad46e1/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
13
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
14
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
15
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
16
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
17
+github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
18
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
19
+go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
20
+go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
21
+go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
22
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
23
+go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=
24
+go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
25
+golang.org/x/net v0.0.0-20180921000356-2f5d2388922f h1:QM2QVxvDoW9PFSPp/zy9FgxJLfaWTZlS61KEPtBwacM=
26
+golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
27
+gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
28
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
29
+gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVCwMc=
30
+gopkg.in/alexcesaro/statsd.v2 v2.0.0/go.mod h1:i0ubccKGzBVNBpdGV5MocxyA/XlLUJzA7SLonnE4drU=

Загрузка…
Отмена
Сохранить