Convert to Go modules (#24)

This commit is contained in:
Maxim Baz 2019-03-13 00:13:03 +01:00 committed by GitHub
parent 0c183fa9d5
commit 06a86da820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 64 additions and 150 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/browserpass
/browserpass-*
vendor/
dist/

View File

@ -1,4 +1,4 @@
language: go
install:
- go get -u github.com/golang/dep/cmd/dep
env:
- GO111MODULE=on

View File

@ -1,11 +1,6 @@
FROM golang:latest
ENV APP_PATH="$GOPATH/src/github.com/browserpass/browserpass-native"
RUN go get -u github.com/golang/dep/cmd/dep && \
mkdir -p $APP_PATH && \
ln -s $APP_PATH /
WORKDIR $APP_PATH
VOLUME /src
WORKDIR /src
ENTRYPOINT ["make"]

72
Gopkg.lock generated
View File

@ -1,72 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:0f51cee70b0d254dbc93c22666ea2abf211af81c1701a96d04e2284b408621db"
name = "github.com/konsorten/go-windows-terminal-sequences"
packages = ["."]
pruneopts = ""
revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e"
version = "v1.0.2"
[[projects]]
branch = "master"
digest = "1:c186d98ef4526297afabdf84bb02076ea2c78e3b52e88ebdac58325f4f923b8b"
name = "github.com/mattn/go-zglob"
packages = [
".",
"fastwalk",
]
pruneopts = ""
revision = "2ea3427bfa539cca900ca2768d8663ecc8a708c1"
[[projects]]
digest = "1:463cf5034cda51cdb4ce56d317c1c1343be898c2bb5e576666394d53f4ba28cd"
name = "github.com/rifflock/lfshook"
packages = ["."]
pruneopts = ""
revision = "b9218ef580f59a2e72dad1aa33d660150445d05a"
version = "v2.4"
[[projects]]
digest = "1:9a3c631555e0351fdc4e696577bb63afd90c399d782a8462dba9d100d7021db3"
name = "github.com/sirupsen/logrus"
packages = [
".",
"hooks/syslog",
]
pruneopts = ""
revision = "e1e72e9de974bd926e5c56f83753fba2df402ce5"
version = "v1.3.0"
[[projects]]
branch = "master"
digest = "1:f1282b7b8f47533e585be65217b076a5fa31c8b78aa2a3bd353e2bf5dcd8ce2e"
name = "golang.org/x/crypto"
packages = ["ssh/terminal"]
pruneopts = ""
revision = "c2843e01d9a2bc60bb26ad24e09734fdc2d9ec58"
[[projects]]
branch = "master"
digest = "1:dd444162b5f02f1fee86207d1c963790e7a5f8d857c1f2665a75332cb1a511f0"
name = "golang.org/x/sys"
packages = [
"unix",
"windows",
]
pruneopts = ""
revision = "10058d7d4faa7dd5ef860cbd31af00903076e7b8"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/mattn/go-zglob",
"github.com/rifflock/lfshook",
"github.com/sirupsen/logrus",
"github.com/sirupsen/logrus/hooks/syslog",
"golang.org/x/sys/unix",
]
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,33 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
[[constraint]]
name = "github.com/sirupsen/logrus"
version = "1.3.0"
[[constraint]]
name = "github.com/rifflock/lfshook"
version = "2.4.0"
[[constraint]]
branch = "master"
name = "github.com/mattn/go-zglob"

View File

@ -7,11 +7,7 @@ OS = $(shell uname -s)
# For local development
.PHONY: all
all: deps browserpass test
.PHONY: deps
deps:
dep ensure -vendor-only
all: browserpass test
browserpass: *.go **/*.go
go build -o $@
@ -41,23 +37,10 @@ test:
.PHONY: clean
clean:
rm -f browserpass browserpass-*
rm -rf dist vendor
.PHONY: tarball
tarball: clean deps
$(eval TMPDIR := $(shell mktemp -d))
mkdir -p $(TMPDIR)/browserpass-native
cp -r * $(TMPDIR)/browserpass-native
rm -rf $(TMPDIR)/browserpass-native/.git
(cd $(TMPDIR) && tar -czf $(TMPDIR)/browserpass-native-src.tar.gz browserpass-native)
mkdir -p dist
cp $(TMPDIR)/browserpass-native-src.tar.gz dist/
rm -rf $(TMPDIR)
rm -rf dist
.PHONY: dist
dist: clean deps tarball browserpass-linux64 browserpass-darwinx64 browserpass-openbsd64 browserpass-freebsd64 browserpass-windows64
dist: clean browserpass-linux64 browserpass-darwinx64 browserpass-openbsd64 browserpass-freebsd64 browserpass-windows64
mkdir -p dist
zip -FS dist/browserpass-linux64 browserpass-linux64 browser-files/* Makefile README.md LICENSE
zip -FS dist/browserpass-darwinx64 browserpass-darwinx64 browser-files/* Makefile README.md LICENSE

View File

@ -2,40 +2,39 @@
## Build locally
Make sure you have Golang and [dep](https://github.com/golang/dep) installed.
Make sure you have Golang installed.
The following `make` goals are available:
| Command | Description |
| ---------------------------- | ------------------------------------------------------------ |
| `make` or `make all` | Fetch the latest dependencies, compile the app and run tests |
| `make deps` | Fetch the latest dependencies |
| `make browserpass` | Compile the app for your OS |
| `make browserpass-linux64` | Compile the app for Linux 64-bit |
| `make browserpass-windows64` | Compile the app for Windows 64-bit |
| `make browserpass-darwin64` | Compile the app for Mac OS X 64-bit |
| `make browserpass-openbsd64` | Compile the app for OpenBSD 64-bit |
| `make browserpass-freebsd64` | Compile the app for FreeBSD 64-bit |
| `make test` | Run tests |
| Command | Description |
| ---------------------------- | ----------------------------------- |
| `make` or `make all` | Compile the app and run tests |
| `make browserpass` | Compile the app for your OS |
| `make browserpass-linux64` | Compile the app for Linux 64-bit |
| `make browserpass-windows64` | Compile the app for Windows 64-bit |
| `make browserpass-darwin64` | Compile the app for Mac OS X 64-bit |
| `make browserpass-openbsd64` | Compile the app for OpenBSD 64-bit |
| `make browserpass-freebsd64` | Compile the app for FreeBSD 64-bit |
| `make test` | Run tests |
## Build using Docker
First build the docker image using the following command in the project root:
```shell
docker build -t browserpass .
docker build -t browserpass-native .
```
The entry point in the docker image is the `make` command. To run it:
```shell
docker run --rm -v "$(pwd)":/browserpass-native browserpass
docker run --rm -v "$(pwd)":/src browserpass-native
```
Specify `make` goal(s) as the last parameter, for example:
```shell
docker run --rm -v "$(pwd)":/browserpass-native browserpass test
docker run --rm -v "$(pwd)":/src browserpass-native test
```
Refer to the list of available `make` goals above.

13
go.mod Normal file
View File

@ -0,0 +1,13 @@
module github.com/browserpass/browserpass-native
go 1.12
require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-zglob v0.0.1
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/sirupsen/logrus v1.4.0
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 // indirect
golang.org/x/sys v0.0.0-20190312061237-fead79001313
)

30
go.sum Normal file
View File

@ -0,0 +1,30 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-zglob v0.0.1 h1:xsEx/XUoVlI6yXjqBK062zYhRTZltCNmYPx6v+8DNaY=
github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
github.com/sirupsen/logrus v1.4.0 h1:yKenngtzGh+cUSSh6GWbxW2abRqhYUSR/t/6+2QqNvE=
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313 h1:pczuHS43Cp2ktBEEmLwScxgjWsBSzdaQiKzUyf3DTTc=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=