Skip to content

Commit

Permalink
Use Go Modules instead of Glock (fixes #338)
Browse files Browse the repository at this point in the history
Previously, this project was using glock to manage external go
dependencies. As of go 1.11, go comes with builtin module support. Go
Modules fully supersede glock functionality. As of go 1.16, either an
environment variable or go modules are required for this project to
build.

This commit migrates the repository away from glock, and instead uses go
modules. This gets rid of an unneeded dependency, and also allows the
project to natively compile under go 1.16 (which requires `go.mod` by
default).

For go >= 1.13, compilation will "just work". To build under go 1.11 and
go 1.12 one needs to set an environment variable 'GO111MODULE=on'. Since
go <= 1.14 can be considered end of life, this change will likely not be
impact any existing build scripts.

This commit also updates the Travis Tests with more modern go versions,
so that they can pass.
  • Loading branch information
tkw1536 committed Apr 2, 2021
1 parent 4edc190 commit 9d81762
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: go
go:
- "1.9"
- "1.10"
- "1.11"
- "1.14"
- "1.15"
- "1.16"
install:
- make get-deps
script:
Expand Down
6 changes: 0 additions & 6 deletions GLOCKFILE

This file was deleted.

5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dist: dist-clean


release: dist
glock sync -n < GLOCKFILE
go mod tidy
tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen
tar -cvzf docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen
tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen
Expand All @@ -43,8 +43,7 @@ release: dist
tar -cvzf docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen

get-deps:
go get github.com/robfig/glock
glock sync -n < GLOCKFILE
go get ./...

check-gofmt:
if [ -n "$(shell gofmt -l .)" ]; then \
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,11 @@ $ docker-gen -notify "/bin/bash /tmp/etcd.sh" -interval 10 templates/etcd.tmpl /

### Development

This project uses [glock](https://github.com/robfig/glock) for managing 3rd party dependencies.
You'll need to install glock into your workspace before hacking on docker-gen.
This project uses [Go Modules](https://golang.org/ref/mod) for managing 3rd party dependencies.
This means that at least `go 1.11` is required.

For `go 1.11` and `go 1.12` it is additionally required to manually enable support by setting `GO111MODULE=on`.
For later versions, this is not required.

```
$ git clone <your fork>
Expand Down
27 changes: 27 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module github.com/jwilder/docker-gen

go 1.11

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/containerd/continuity v0.0.0-20210315143101-93e15499afd5 // indirect
github.com/docker/docker v1.4.2-0.20171014114940-f2afa2623594 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.3.2 // indirect
github.com/fsouza/go-dockerclient v0.0.0-20171009031830-d2a6d0596004
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v0.0.0-20160718151158-d391bea3118c // indirect
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v0.1.1 // indirect
github.com/opencontainers/selinux v1.8.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 // indirect
gotest.tools v2.2.0+incompatible // indirect
)
Loading

0 comments on commit 9d81762

Please sign in to comment.