diff --git a/.gitignore b/.gitignore index c885821..eee53e6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,10 @@ go-neb.db *.a *.so +# Binary file +go-neb + # Folders -bin -pkg _obj _test .idea diff --git a/.travis.yml b/.travis.yml index 5659347..723b9b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,11 @@ language: go go: - - 1.11 + - 1.14 install: - - go get github.com/constabulary/gb/... - - go get github.com/golang/lint/golint + - go get golang.org/x/lint/golint - go get github.com/fzipp/gocyclo -script: gb build github.com/matrix-org/go-neb && ./hooks/pre-commit +script: go build github.com/matrix-org/go-neb && ./hooks/pre-commit notifications: webhooks: diff --git a/Dockerfile b/Dockerfile index 43f1e7d..bcd1c58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,13 @@ # Build go-neb -FROM golang:1.11-alpine as builder +FROM golang:1.14-alpine as builder RUN apk add --no-cache -t build-deps git gcc musl-dev go COPY . /tmp/go-neb WORKDIR /tmp/go-neb -RUN go get -u github.com/constabulary/gb/... \ - && go get github.com/golang/lint/golint \ +RUN go get golang.org/x/lint/golint \ && go get github.com/fzipp/gocyclo \ - && gb vendor restore \ - && gb build -f github.com/matrix-org/go-neb + && go build github.com/matrix-org/go-neb # Ensures we're lint-free RUN /tmp/go-neb/hooks/pre-commit @@ -23,7 +21,7 @@ ENV BIND_ADDRESS=:4050 \ UID=1337 \ GID=1337 -COPY --from=builder /tmp/go-neb/bin/go-neb /usr/local/bin/go-neb +COPY --from=builder /tmp/go-neb/go-neb /usr/local/bin/go-neb RUN apk add --no-cache \ ca-certificates \ su-exec \ diff --git a/README.md b/README.md index 387d2a9..dcaf018 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ Go-NEB is a [Matrix](https://matrix.org) bot written in Go. It is the successor # Quick Start -Clone and run (Requires Go 1.7+ and GB): +Clone and run (Requires Go 1.14+): ```bash -gb build github.com/matrix-org/go-neb -BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=http://localhost:4050 bin/go-neb +go build github.com/matrix-org/go-neb +BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=http://localhost:4050 ./go-neb ``` Get a Matrix user ID and access token and give it to Go-NEB: @@ -85,23 +85,20 @@ Invite the bot user into a Matrix room and type `!echo hello world`. It will rep # Installing -Go-NEB is built using Go 1.7+ and [GB](https://getgb.io/). Once you have installed Go, run the following commands: +Go-NEB is built using Go 1.14+. Once you have installed Go, run the following commands: ```bash -# Install gb -go get github.com/constabulary/gb/... - # Clone the go-neb repository git clone https://github.com/matrix-org/go-neb cd go-neb # Build go-neb -gb build github.com/matrix-org/go-neb +go build github.com/matrix-org/go-neb ``` # Running Go-NEB uses environment variables to configure its SQLite database and bind address. To run Go-NEB, run the following command: ```bash -BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=https://public.facing.endpoint bin/go-neb +BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=https://public.facing.endpoint ./go-neb ``` - `BIND_ADDRESS` is the port to listen on. - `DATABASE_TYPE` MUST be "sqlite3". No other type is supported. @@ -172,7 +169,7 @@ things like linting. Some of them are bundled with go (fmt and vet) but some are not. You should install the ones which are not: ```bash -go get github.com/golang/lint/golint +go get golang.org/x/lint/golint go get github.com/fzipp/gocyclo ``` diff --git a/hooks/pre-commit b/hooks/pre-commit index cb9cd87..41f871a 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -2,8 +2,8 @@ set -eu -golint src/... -go fmt ./src/... -go tool vet --shadow ./src -gocyclo -over 12 src/ -gb test -timeout 5s -test.v +golint ./... +go fmt ./... +go vet -composites=false ./... +gocyclo -over 12 . +go test ./...