Browse Source

Update docs, configs and dockerfile to use latest Go version

Signed-off-by: Nikos Filippakis <me@nfil.dev>
pull/310/head
Nikos Filippakis 6 years ago
parent
commit
406cdc5fff
  1. 5
      .gitignore
  2. 7
      .travis.yml
  3. 10
      Dockerfile
  4. 17
      README.md
  5. 10
      hooks/pre-commit

5
.gitignore

@ -7,9 +7,10 @@ go-neb.db
*.a
*.so
# Binary file
go-neb
# Folders
bin
pkg
_obj
_test
.idea

7
.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:

10
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 \

17
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
```

10
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 ./...
Loading…
Cancel
Save