Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Upgrade to golang 1.12 (#10)
Browse files Browse the repository at this point in the history
Also switch to go mod, pre-commit and golangci-lint and vendor tools go mod style. Use templates in endpoints (but continue to use packr to create executable that can generate extensions for now).
  • Loading branch information
ashanbrown authored Sep 1, 2019
1 parent 68b861d commit 19a6e48
Show file tree
Hide file tree
Showing 274 changed files with 43,859 additions and 219 deletions.
25 changes: 12 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ experimental:

jobs:
build:
working_directory: /go/src/github.com/launchdarkly/gauche-links
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.12
environment:
- GO_PACKAGES: >
github.com/jstemmer/go-junit-report
gopkg.in/alecthomas/gometalinter.v2
github.com/gobuffalo/packr/...
- TEST_RESULTS: /tmp/test-results
GO_TOOL_PACKAGES: >
github.com/jstemmer/go-junit-report
TEST_RESULTS: /tmp/test-results
GOFLAGS: -mod=vendor
steps:
- checkout
- run: go get -u $GO_PACKAGES
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: dep ensure -vendor-only
- run: gometalinter.v2 --install
- run: gometalinter.v2 ./...
- run: go install $GO_TOOL_PACKAGES
# We have to install python to use pre-commit :(
- run: sudo apt-get install python-pip
- run: sudo pip install pre-commit
- run: make init
- run: pre-commit run -a
- run:
name: Verify that packr files are committed
command: packr && git status --porcelain
command: make packr && git status --porcelain
- run: go build ./...
- run: mkdir -p ${TEST_RESULTS}
- run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
build/
gauche-links
/vendor/
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
linters:
enable-all: true
disable:
- gochecknoinits
- gochecknoglobals

issues:
exclude-rules:
- path: "^tools/tools.go"
text: "is a program, not an importable package"
linters:
- typecheck

run:
modules-download-mode: readonly
10 changes: 0 additions & 10 deletions .gometalinter.json

This file was deleted.

26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.17.1
hooks:
- id: golangci-lint

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-merge-conflict
- id: check-json
- id: check-symlinks
- id: check-yaml

- repo: https://github.com/danielhoherd/pre-commit-circleci
rev: v0.0.3
hooks:
- id: circleci-validate

- repo: local
hooks:
- id: go-mod-verify
name: go mod verify
language: system
entry: go mod verify
pass_filenames: false
93 changes: 0 additions & 93 deletions Gopkg.lock

This file was deleted.

46 changes: 0 additions & 46 deletions Gopkg.toml

This file was deleted.

21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
test: pack
gometalinter.v2 ./...
PACKR = $(GOPATH)/bin/packr

init: $(PACKR)

$(PACKR):
go install github.com/gobuffalo/packr/packr

test: test-extensions
go test ./...

pack:
packr
test-extensions:
dir="$$(mktemp -d)"; \
trap 'rm -rf "$${dir}"' EXIT; \
go run . -extensions -prefix test -extensions-path "$${dir}"; \

packr:
$(PACKR)

.PHONY: packr test
.PHONY: packr test test-extensions
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Then you can construct the configuration above.

GaucheLinks takes can be run via the cli to build extensions for Chrome and Firefox.

```guache-links -extenions -prefix <prefix> -extensions-path <where to put it> -host <the host name> -dev-host <the development host name> -version <extension version>```
```gauche-links -extensions -prefix <prefix> -extensions-path <where to put it> -host <the host name> -dev-host <the development host name> -version <extension version>```

The sample demo appengine deploy shows how the artifacts can be made available as static links.

Expand Down
17 changes: 0 additions & 17 deletions extension/a_extension-packr.go

This file was deleted.

6 changes: 3 additions & 3 deletions extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

const TemplateSuffix = ".tmpl"

type ExtensionConfig struct {
type Config struct {
DevHost string
Host string
Icon string
Expand All @@ -32,7 +32,7 @@ func init() {
extensionBox = packr.NewBox("./source")
}

func Build(config ExtensionConfig, targetDirPath string) error {
func Build(config Config, targetDirPath string) error {
b := crxmake.NewBuilder()

tempDir, err := ioutil.TempDir("", "gauche-links-build-extension")
Expand Down Expand Up @@ -140,7 +140,7 @@ func Build(config ExtensionConfig, targetDirPath string) error {
return nil
}

func zipExtension(dstFile *os.File, srcDir string) error {
func zipExtension(dstFile io.Writer, srcDir string) error {
archive := zip.NewWriter(bufio.NewWriter(dstFile))
defer func() { _ = archive.Close() }()

Expand Down
23 changes: 23 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module github.com/launchdarkly/gauche-links

go 1.12

require (
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 // indirect
github.com/fabioberger/airtable-go v3.1.0+incompatible
github.com/gobuffalo/packr v1.10.4
github.com/golang/protobuf v1.0.0 // indirect
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f // indirect
github.com/gorilla/mux v1.6.1
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024
github.com/kelseyhightower/envconfig v1.3.0
github.com/kr/pretty v0.1.0 // indirect
github.com/mcuadros/go-crxmake v0.2.0
github.com/pkg/errors v0.8.0 // indirect
github.com/spf13/cobra v0.0.5 // indirect
github.com/stretchr/testify v1.2.2
golang.org/x/net v0.0.0-20180306060152-d25186b37f34 // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
google.golang.org/appengine v1.0.0
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
69 changes: 69 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
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/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/fabioberger/airtable-go v3.1.0+incompatible h1:n5dw+HWBc+hytrVL75xe94EGt7FtNFGDII1tNoWTCAE=
github.com/fabioberger/airtable-go v3.1.0+incompatible/go.mod h1:EoKuSh7EefzhMCyVr6iXPlgFzDgHyZCZ3E5Sg8Cy9GM=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gobuffalo/packr v1.10.4 h1:k/aQq1+9UlSxfr9+QXz1sQ8vJVFTXqrEDdKgeonlt4Y=
github.com/gobuffalo/packr v1.10.4/go.mod h1:rYwMLC6NXbAbkKb+9j3NTKbxSswkKLlelZYccr4HYVw=
github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ=
github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f h1:9oNbS1z4rVpbnkHBdPZU4jo9bSmrLpII768arSyMFgk=
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.1 h1:KOwqsTYZdeuMacU7CxjMNYEKeBvLbxW+psodrbcEa3A=
github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/kelseyhightower/envconfig v1.3.0 h1:IvRS4f2VcIQy6j4ORGIf9145T/AsUB+oY8LyvN8BXNM=
github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mcuadros/go-crxmake v0.2.0 h1:8GWLe7cvt7yikxhDaJ1UGS/ZaJ+z8RfPsUDDykdE98g=
github.com/mcuadros/go-crxmake v0.2.0/go.mod h1:e1pmTPEEtx+6xP1zZWwREfPw5dCcZ/Lcd2UR8B05vbw=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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 v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180306060152-d25186b37f34 h1:iFnCuNSN/vI6MpVNGKchMAS+XtQqe4z/g9mSPtIKy8E=
golang.org/x/net v0.0.0-20180306060152-d25186b37f34/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.0.0 h1:dN4LljjBKVChsv0XCSI+zbyzdqrkEwX5LQFUMRSGqOc=
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Loading

0 comments on commit 19a6e48

Please sign in to comment.