Browse Source

Include a basic go.mod that declares the package name

Work on Go Modules has been moving steadily with basic support in 1.11
and more mature support in the recently released 1.12. Eventually we
should look at using it for dependency management (away from `dep`) but
let's start by simply declaring the package name in a new `go.mod` to
allow building of our project outside the hell that is `GOPATH`.

Change-Id: I90b9f35194afe5538dce8db67b2b7c2d551bfaff
Dan Duvall 6 months ago
parent
commit
ec0af37c1e
4 changed files with 5 additions and 10 deletions
  1. 0
    2
      .pipeline/blubber.yaml
  2. 1
    1
      CONTRIBUTING.md
  3. 3
    7
      Makefile
  4. 1
    0
      go.mod

+ 0
- 2
.pipeline/blubber.yaml View File

@@ -1,7 +1,5 @@
1 1
 version: v3
2 2
 base: docker-registry.wikimedia.org/wikimedia-stretch:latest
3
-lives:
4
-  in: /go/src/gerrit.wikimedia.org/r/blubber
5 3
 
6 4
 variants:
7 5
   build:

+ 1
- 1
CONTRIBUTING.md View File

@@ -8,7 +8,7 @@ to both users inside and outside of WMF and our communities.
8 8
 
9 9
 ## Requirements
10 10
 
11
- 1. `go` >= 1.9 (>=1.10 recommended) and related tools
11
+ 1. `go` >= 1.11 (>=1.12 recommended) and related tools
12 12
     * To install on rpm style systems: `sudo dnf install golang golang-godoc`
13 13
     * To install on apt style systems: `sudo apt install golang golang-golang-x-tools`
14 14
     * To install on macOS use [Homebrew](https://brew.sh) and run:

+ 3
- 7
Makefile View File

@@ -3,7 +3,6 @@ RELEASE_DIR ?= ./_release
3 3
 TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 plan9/amd64
4 4
 
5 5
 PACKAGE := gerrit.wikimedia.org/r/blubber
6
-REAL_CURDIR := $(shell readlink "$(CURDIR)" || echo "$(CURDIR)")
7 6
 
8 7
 GO_LIST_GOFILES := '{{range .GoFiles}}{{printf "%s/%s\n" $$.Dir .}}{{end}}{{range .XTestGoFiles}}{{printf "%s/%s\n" $$.Dir .}}{{end}}'
9 8
 GO_PACKAGES := $(shell go list ./...)
@@ -14,11 +13,8 @@ GO_LDFLAGS := \
14 13
 
15 14
 # go build/install commands
16 15
 #
17
-# workaround bug in case CURDIR is a symlink
18
-# see https://github.com/golang/go/issues/24359
19
-GO_GENERATE := cd "$(REAL_CURDIR)" && go generate
20
-GO_BUILD := cd "$(REAL_CURDIR)" && go build -v -ldflags "$(GO_LDFLAGS)"
21
-GO_INSTALL := cd "$(REAL_CURDIR)" && go install -v -ldflags "$(GO_LDFLAGS)"
16
+GO_BUILD := go build -v -ldflags "$(GO_LDFLAGS)"
17
+GO_INSTALL := go install -v -ldflags "$(GO_LDFLAGS)"
22 18
 
23 19
 all: code blubber blubberoid
24 20
 
@@ -29,7 +25,7 @@ blubberoid:
29 25
 	$(GO_BUILD) ./cmd/blubberoid
30 26
 
31 27
 code:
32
-	$(GO_GENERATE) $(GO_PACKAGES)
28
+	go generate $(GO_PACKAGES)
33 29
 
34 30
 clean:
35 31
 	go clean

+ 1
- 0
go.mod View File

@@ -0,0 +1 @@
1
+module gerrit.wikimedia.org/r/blubber

Loading…
Cancel
Save