Skip to content

Commit

Permalink
Migrate to Go modules on Go 1.13 (#72)
Browse files Browse the repository at this point in the history
* Migrate to Go modules on Go 1.13

This enables Go modules and removes dep as a build dependency.

* Move to golangci from gometalinter

* Disable linters which fail for now
  • Loading branch information
theatrus authored Sep 23, 2019
1 parent 9970112 commit 782697c
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 299 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language:
- go

go:
- "1.11"
- "1.13"

script:
- which go
Expand Down
260 changes: 0 additions & 260 deletions Gopkg.lock

This file was deleted.

20 changes: 0 additions & 20 deletions Gopkg.toml

This file was deleted.

24 changes: 6 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME=cni-ipvlan-vpc-k8s
VERSION:=$(shell git describe --tags)
DOCKER_IMAGE=lyft/cni-ipvlan-vpc-k8s:$(VERSION)
DEP:= $(shell command -v dep 2> /dev/null || $(GOPATH)/bin/dep)
export GO111MODULE=on

.PHONY: all
all: build test
Expand All @@ -10,33 +10,24 @@ all: build test
clean:
rm -f *.tar.gz $(NAME)-*

.PHONY: dep
dep:
$(DEP) ensure -v

.PHONY: cache
cache:
go install ./

.PHONY: lint
lint:
gometalinter.v2 --disable-all \
--enable=golint --enable=megacheck \
--enable=gofmt \
--deadline=10m --vendor ./... \
--exclude="Errors unhandled.*" \
--enable-gc
golangci-lint run -D errcheck -D govet

.PHONY: test
test: dep cache lint
test: cache
ifndef GOOS
go test -v ./aws/... ./nl ./cmd/cni-ipvlan-vpc-k8s-tool ./lib/...
else
@echo Tests not available when cross-compiling
endif

.PHONY: build
build: dep cache
build: cache
go build -i -o $(NAME)-ipam ./plugin/ipam/main.go
go build -i -o $(NAME)-ipvlan ./plugin/ipvlan/ipvlan.go
go build -i -o $(NAME)-unnumbered-ptp ./plugin/unnumbered-ptp/unnumbered-ptp.go
Expand All @@ -58,9 +49,6 @@ interactive-docker: test-docker

.PHONY: ci
ci:
go get -u github.com/golang/dep/cmd/dep
go install github.com/golang/dep/cmd/dep
go get -u gopkg.in/alecthomas/gometalinter.v2
gometalinter.v2 --install

go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
$(MAKE) all
$(MAKE) lint
30 changes: 30 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module github.com/lyft/cni-ipvlan-vpc-k8s

go 1.13

require (
github.com/Microsoft/go-winio v0.4.11
github.com/alecthomas/units v0.0.0-20190910110746-680d30ca3117 // indirect
github.com/aws/aws-sdk-go v1.12.79
github.com/containernetworking/cni v0.6.0
github.com/containernetworking/plugins v0.7.4
github.com/coreos/go-iptables v0.4.0
github.com/docker/distribution v2.6.2+incompatible
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.3.3
github.com/go-ini/ini v1.39.0
github.com/golangci/golangci-lint v1.18.0 // indirect
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf // indirect
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
github.com/nightlyone/lockfile v0.0.0-20180618180623-0ad87eef1443
github.com/pkg/errors v0.8.1
github.com/urfave/cli v1.20.0
github.com/vishvananda/netlink v1.0.0
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
golang.org/x/sys v0.0.0-20190312061237-fead79001313
gopkg.in/alecthomas/gometalinter.v2 v2.0.12 // indirect
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c // indirect
)
Loading

0 comments on commit 782697c

Please sign in to comment.