From 5d6083df7e0399d9cbb47a9dc0b227fd86ccffbb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 9 Oct 2018 18:11:36 +0200 Subject: [PATCH] Switch to go modules --- Gopkg.lock | 42 ------------------------------------------ Gopkg.toml | 15 --------------- Makefile | 29 ++++++----------------------- README.md | 2 +- go.mod | 7 +++++++ go.sum | 6 ++++++ 6 files changed, 20 insertions(+), 81 deletions(-) delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index b0e361e..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,42 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = [ - "blake2s", - "chacha20poly1305", - "curve25519", - "internal/chacha20", - "poly1305" - ] - revision = "ab813273cd59e1333f7ae7bff5d027d4aadf528c" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = [ - "bpf", - "internal/iana", - "internal/socket", - "ipv4", - "ipv6" - ] - revision = "dfa909b99c79129e1100513e5cd36307665e5723" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = [ - "cpu", - "unix" - ] - revision = "c11f84a56e43e20a78cee75a7c034031ecf57d1f" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "d85ae9d2b4afafc3d7535505c46368cbbbec350cf876616302c1bcf44f6ec103" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 3aafd44..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,15 +0,0 @@ -[[constraint]] - branch = "master" - name = "golang.org/x/crypto" - -[[constraint]] - branch = "master" - name = "golang.org/x/net" - -[[constraint]] - branch = "master" - name = "golang.org/x/sys" - -[prune] - go-tests = true - unused-packages = true diff --git a/Makefile b/Makefile index e10fdc2..6b95f89 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,9 @@ $(shell printf 'package main\nconst UseTheKernelModuleInstead = 0xdeadbabe\n' > endif endif -all: wireguard-go +export GOPATH ?= $(CURDIR)/.gopath -export GOPATH := $(CURDIR)/.gopath -export PATH := $(PATH):$(CURDIR)/.gopath/bin -GO_IMPORT_PATH := git.zx2c4.com/wireguard-go +all: wireguard-go version.go: @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \ @@ -24,28 +22,13 @@ version.go: echo "$$ver" > $@ && \ git update-index --assume-unchanged $@ || true -.gopath/.created: - rm -rf .gopath - mkdir -p $(dir .gopath/src/$(GO_IMPORT_PATH)) - ln -s ../../.. .gopath/src/$(GO_IMPORT_PATH) - touch $@ - -vendor/.created: Gopkg.toml Gopkg.lock | .gopath/.created - command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep - export PWD; cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -vendor-only -v - touch $@ - -wireguard-go: $(wildcard *.go) $(wildcard */*.go) .gopath/.created vendor/.created version.go - go build -v $(GO_IMPORT_PATH) +wireguard-go: $(wildcard *.go) $(wildcard */*.go) + go build -v -o "$@" install: wireguard-go - @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 wireguard-go "$(DESTDIR)$(BINDIR)/wireguard-go" + @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/wireguard-go" clean: rm -f wireguard-go -update-dep: | .gopath/.created - command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep - cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -update -v - -.PHONY: clean install update-dep version.go +.PHONY: clean install version.go diff --git a/README.md b/README.md index 72d0e0c..3aa1f29 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ This will run on OpenBSD. It does not yet support sticky sockets. Fwmark is mapp ## Building -This requires an installation of [go](https://golang.org) and of [dep](https://github.com/golang/dep). If dep is not installed, it will be downloaded and built as part of the build process. +This requires an installation of [go](https://golang.org) ≥ 1.11. ``` $ git clone https://git.zx2c4.com/wireguard-go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d52cb0e --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module git.zx2c4.com/wireguard-go + +require ( + golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 + golang.org/x/net v0.0.0-20181005035420-146acd28ed58 + golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..83e6998 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 h1:Vk3wNqEZwyGyei9yq5ekj7frek2u7HUfffJ1/opblzc= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58 h1:otZG8yDCO4LVps5+9bxOeNiCvgmOyt96J3roHTYs7oE= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=