Skip to content

Commit 475005a

Browse files
rogchapfilipesperandio
authored andcommitted
Update to Go 1.13 and use modules to track versions (#24)
1 parent c38edbf commit 475005a

File tree

8 files changed

+40
-52
lines changed

8 files changed

+40
-52
lines changed

Dockerfile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
FROM alpine:edge
1+
ARG BASE=1.13.1-alpine3.10
2+
FROM golang:${BASE} as build
23

4+
WORKDIR /usr/src/app
5+
6+
COPY engine.json ./engine.json.template
7+
RUN apk add --no-cache jq
8+
RUN export go_version=$(go version | cut -d ' ' -f 3) && \
9+
cat engine.json.template | jq '.version = .version + "/" + env.go_version' > ./engine.json
10+
11+
COPY codeclimate-golint.go go.mod go.sum ./
12+
RUN apk add --no-cache git
13+
RUN go build -o codeclimate-golint .
14+
15+
FROM golang:${BASE}
316
LABEL maintainer="Code Climate <hello@codeclimate.com>"
417

518
RUN adduser -u 9000 -D app
619

720
WORKDIR /usr/src/app
821

9-
COPY engine.json /engine.json
10-
COPY codeclimate-golint.go /usr/src/app/codeclimate-golint.go
11-
12-
RUN apk add --no-cache --virtual .dev-deps musl-dev go git && \
13-
export GOPATH=/tmp/go GOBIN=/usr/local/bin && \
14-
go get -d -t -v . && \
15-
export LIBRARY_PATH=/usr/lib32:$LIBRARY_PATH && \
16-
go install codeclimate-golint.go && \
17-
apk del .dev-deps && \
18-
rm -rf "$GOPATH"
22+
COPY --from=build /usr/src/app/engine.json /
23+
COPY --from=build /usr/src/app/codeclimate-golint ./
1924

2025
USER app
21-
WORKDIR /code
2226
VOLUME /code
2327

24-
CMD ["/usr/local/bin/codeclimate-golint"]
28+
CMD ["/usr/src/app/codeclimate-golint"]

Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,5 @@
22

33
IMAGE_NAME ?= codeclimate/codeclimate-golint
44

5-
update:
6-
docker run \
7-
--rm --interactive \
8-
-v $(PWD)/engine.json:/engine.json \
9-
-v $(PWD)/bin/update:/usr/local/bin/update \
10-
alpine:edge \
11-
/usr/local/bin/update
12-
13-
image: update
5+
image:
146
docker build --rm -t $(IMAGE_NAME) .

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ plugins:
3737
make image
3838
```
3939

40-
### Updating
41-
42-
`golint` doesn't version releases, so in order to get the latest version & force
43-
a new docker image build, we have to update the `engine.json` file.
44-
45-
```console
46-
make update
47-
```
48-
49-
This will update the engine version with the latest `golint` version. After that
50-
rebuild the image as usually.
51-
5240
### Need help?
5341

5442
For help with Golint, [check out their documentation](https://github.com/golang/lint).

bin/update

Lines changed: 0 additions & 15 deletions
This file was deleted.

codeclimate-golint.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/codeclimate/cc-engine-go/engine"
6-
"github.com/golang/lint"
75
"io/ioutil"
86
"os"
97
"strconv"
108
"strings"
9+
10+
"github.com/codeclimate/cc-engine-go/engine"
11+
"golang.org/x/lint"
1112
)
1213

1314
const defaultMinConfidence = 0.8

engine.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"languages": [
99
"Go"
1010
],
11-
"version": "1.0.0/6aaf7c34af0f4c36a57e0c429bace4d706d8e931",
11+
"version": "1.0.0",
1212
"spec_version": "0.3.1"
1313
}

go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/codeclimate-community/codeclimate-golint
2+
3+
go 1.13
4+
5+
require (
6+
github.com/codeclimate/cc-engine-go v0.0.0-20160217183426-55f9c825e2a9
7+
golang.org/x/lint v0.0.0-20190930215403-16217165b5de
8+
)

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/codeclimate/cc-engine-go v0.0.0-20160217183426-55f9c825e2a9 h1:Wk8UDfEjmZtZI8guLovZZ1QXkbGIPWy2cpeYS2JgKPg=
2+
github.com/codeclimate/cc-engine-go v0.0.0-20160217183426-55f9c825e2a9/go.mod h1:A0vs4JxevyA0WJrMjU/5sedZBlICgsdPloAKENM2JmU=
3+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
4+
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
5+
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
6+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
7+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
8+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
9+
golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ=
10+
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=

0 commit comments

Comments
 (0)