diff --git a/.gitignore b/.gitignore index 0047d7e..89f0235 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *~ **/main *.swp +build/ +coverage.txt diff --git a/.travis.yml b/.travis.yml index 35dfb22..497a1b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,12 @@ language: go sudo: false go: - - 1.x - -before_install: - - go get -t -v ./... + - '1.13.x' + - '1.14.x' script: - ./test.sh + - go build -v -o build/easypki ./cmd/easypki after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/cmd/easypki/main.go b/cmd/easypki/main.go index bf55692..25293b3 100644 --- a/cmd/easypki/main.go +++ b/cmd/easypki/main.go @@ -28,10 +28,10 @@ import ( "encoding/pem" - "github.com/codegangsta/cli" "github.com/google/easypki/pkg/certificate" "github.com/google/easypki/pkg/easypki" "github.com/google/easypki/pkg/store" + "github.com/urfave/cli" ) const ( diff --git a/example/client-auth/client-auth.go b/example/client-auth/client-auth.go index 8b1e4bf..1f991b1 100644 --- a/example/client-auth/client-auth.go +++ b/example/client-auth/client-auth.go @@ -10,11 +10,11 @@ import ( "os" "time" - "github.com/boltdb/bolt" "github.com/go-yaml/yaml" "github.com/google/easypki/pkg/certificate" "github.com/google/easypki/pkg/easypki" "github.com/google/easypki/pkg/store" + bolt "go.etcd.io/bbolt" ) func main() { diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4c822b2 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/google/easypki + +go 1.13 + +require ( + github.com/go-yaml/yaml v2.1.0+incompatible + github.com/urfave/cli v1.22.4 + go.etcd.io/bbolt v1.3.4 + golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..2853b80 --- /dev/null +++ b/go.sum @@ -0,0 +1,22 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= +github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/pkg/easypki/easypki_test.go b/pkg/easypki/easypki_test.go index 77a5858..1670400 100644 --- a/pkg/easypki/easypki_test.go +++ b/pkg/easypki/easypki_test.go @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/boltdb/bolt" "github.com/google/easypki/pkg/store" + bolt "go.etcd.io/bbolt" "reflect" ) diff --git a/pkg/store/bolt.go b/pkg/store/bolt.go index 4f4f5a9..c62ad49 100644 --- a/pkg/store/bolt.go +++ b/pkg/store/bolt.go @@ -22,8 +22,8 @@ import ( "fmt" - "github.com/boltdb/bolt" "github.com/google/easypki/pkg/certificate" + bolt "go.etcd.io/bbolt" ) var ( diff --git a/pkg/store/bolt_test.go b/pkg/store/bolt_test.go index 6ae940d..e4b30e1 100644 --- a/pkg/store/bolt_test.go +++ b/pkg/store/bolt_test.go @@ -23,8 +23,8 @@ import ( "reflect" - "github.com/boltdb/bolt" "github.com/google/easypki/pkg/certificate" + bolt "go.etcd.io/bbolt" ) func TestBolt(t *testing.T) { diff --git a/pkg/store/local.go b/pkg/store/local.go index 1895e83..8d188af 100644 --- a/pkg/store/local.go +++ b/pkg/store/local.go @@ -48,7 +48,7 @@ var ( // 4 Serial // 5 Filename // 6 Subject - indexRegexp = regexp.MustCompile("^(V|R|E)\t([0-9]{12}Z)\t([0-9]{12}Z)?\t([0-9a-fA-F]{2,})\t([^\t]+)\t(.+)") + indexRegexp = regexp.MustCompile("^([VRE])\t([0-9]{12}Z)\t([0-9]{12}Z)?\t([0-9a-fA-F]{2,})\t([^\t]+)\t(.+)") ) // Local lets us store a Certificate Authority on the local filesystem. diff --git a/test.sh b/test.sh index 34dbbfb..33d7510 100755 --- a/test.sh +++ b/test.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash -set -e -echo "" > coverage.txt +set -Eeuo pipefail + +true > coverage.txt for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic $d + go test -race -coverprofile=profile.out -covermode=atomic "$d" if [ -f profile.out ]; then cat profile.out >> coverage.txt - rm profile.out + rm -f profile.out fi done