From d92c66ea1d7d8c4181e7d659305dc91fc5c65610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Sowa?= Date: Fri, 15 Apr 2022 08:52:57 +0200 Subject: [PATCH] Update go version --- .github/workflows/release-dry-run.yml | 5 +---- .github/workflows/release.yml | 5 +---- .github/workflows/test.yml | 2 +- .gitignore | 4 +--- .goreleaser.yml | 18 ++++++++++++++---- Makefile | 8 ++------ go.mod | 22 +++++++++++++++++----- go.sum | 13 ++----------- ui/ui.go | 15 +++++++++++---- 9 files changed, 50 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index 6feac33..1200aa1 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15 + go-version: 1.18 - name: Set up Node uses: actions/setup-node@v2 @@ -33,9 +33,6 @@ jobs: - run: yarn build working-directory: ./ui/desktop - - name: Get pkger - run: go get -u github.com/markbates/pkger/cmd/pkger - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cea7120..c845dc5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15 + go-version: 1.18 - name: Set up Node uses: actions/setup-node@v2 @@ -29,9 +29,6 @@ jobs: - run: yarn build working-directory: ./ui/desktop - - name: Get pkger - run: go get -u github.com/markbates/pkger/cmd/pkger - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8322185..4057987 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: [1.15.x, 1.16.x] + go-version: [1.16.x, 1.17.x, 1.18.x] os: [ubuntu-latest, macos-latest, windows-latest] tags: [cli, desktop] runs-on: ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 2ecd275..73bb95a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,8 @@ /certs # Vendor packages /vendor -# pkger files -pkged.go # Node.js files node_modules .eslintcache # Editor files -.vscode \ No newline at end of file +.vscode diff --git a/.goreleaser.yml b/.goreleaser.yml index 1239af7..268e41c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,7 +6,6 @@ env: before: hooks: - go mod download - - pkger builds: - id: loophole-cli @@ -14,7 +13,6 @@ builds: goos: - linux - darwin - - windows goarch: - 386 - amd64 @@ -26,8 +24,19 @@ builds: mod_timestamp: "{{ .CommitTimestamp }}" ldflags: - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} - flags: - - -tags=skippkger +- id: loophole-cli-win + binary: loophole + goos: + - windows + goarch: + - 386 + - amd64 + goarm: + - 6 + - 7 + mod_timestamp: "{{ .CommitTimestamp }}" + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} - id: loophole-desktop binary: loophole-desktop @@ -60,6 +69,7 @@ archives: - id: cli builds: - loophole-cli + - loophole-cli-win replacements: amd64: 64bit 386: 32bit diff --git a/Makefile b/Makefile index 02fc085..a173413 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,10 @@ build-frontend: ${MAKE} -C ui/desktop build -.PHONY: generate -generate: - pkger - .PHONY: build-cli build-cli: loophole - go build -tags cli,skippkger -o loophole . + go build -tags cli -o loophole . .PHONY: build-desktop generate build-dektop: build-frontend loophole-desktop - go build -tags desktop -o loophole-desktop . \ No newline at end of file + go build -tags desktop -o loophole-desktop . diff --git a/go.mod b/go.mod index 7f0bfe0..e5a449d 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,14 @@ module github.com/loophole/cli -go 1.14 +go 1.18 require ( github.com/abbot/go-http-auth v0.4.0 github.com/beevik/guid v0.0.0-20170504223318-d0ea8faecee0 github.com/blang/semver/v4 v4.0.0 github.com/briandowns/spinner v1.11.1 - github.com/gobuffalo/here v0.6.2 // indirect github.com/gorilla/websocket v1.4.1 github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 - github.com/markbates/pkger v0.17.1 github.com/mattn/go-colorable v0.1.2 github.com/mdp/qrterminal v1.0.1 github.com/mitchellh/go-homedir v1.1.0 @@ -20,10 +18,24 @@ require ( github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 - github.com/zserge/lorca v0.1.9 + github.com/zserge/lorca v0.1.10 golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 golang.org/x/net v0.0.0-20200301022130-244492dfa37a - golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf +) + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/fatih/color v1.7.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/kr/pretty v0.2.0 // indirect + github.com/mattn/go-isatty v0.0.8 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + golang.org/x/image v0.0.0-20201208152932-35266b937fa6 // indirect + golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect golang.org/x/text v0.3.2 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect + rsc.io/qr v0.2.0 // indirect ) diff --git a/go.sum b/go.sum index 7285364..5a03d00 100644 --- a/go.sum +++ b/go.sum @@ -24,7 +24,6 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= @@ -36,9 +35,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= -github.com/gobuffalo/here v0.6.2 h1:ZtCqC7F9ou3moLbYfHM1Tj+gwHGgWhjyRjVjsir9BE0= -github.com/gobuffalo/here v0.6.2/go.mod h1:D75Sq0p2BVHdgQu3vCRsXbg85rx943V19urJpqAVWjI= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -72,8 +68,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/markbates/pkger v0.17.1 h1:/MKEtWqtc0mZvu9OinB9UzVN9iYCwLWuyUv4Bw+PCno= -github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -130,14 +124,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/zserge/lorca v0.1.9 h1:vbDdkqdp2/rmeg8GlyCewY2X8Z+b0s7BqWyIQL/gakc= -github.com/zserge/lorca v0.1.9/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A= +github.com/zserge/lorca v0.1.10 h1:f/xBJ3D3ipcVRCcvN8XqZnpoKcOXV8I4vwqlFyw7ruc= +github.com/zserge/lorca v0.1.10/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= @@ -212,7 +204,6 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ui/ui.go b/ui/ui.go index 653a479..2999387 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -1,14 +1,16 @@ +//go:build desktop // +build desktop package ui import ( + "embed" "encoding/json" "fmt" + "io/fs" "net" "net/http" - "github.com/markbates/pkger" "github.com/ncruces/zenity" "github.com/rs/zerolog/log" "github.com/skratchdot/open-golang/open" @@ -232,6 +234,9 @@ func websocketHandler(w http.ResponseWriter, r *http.Request) { } } +//go:embed desktop/build/* +var box embed.FS + // Display shows the main app window func Display() { chromeLocation := lorca.LocateChrome() @@ -241,10 +246,12 @@ func Display() { communication.Fatal(message) } - // path is absolute with / set to module (repository) root - box := pkger.Dir("/ui/desktop/build") + subFS, err := fs.Sub(box, "desktop/build") + if err != nil { + panic(err) + } - http.Handle("/", http.FileServer(box)) + http.Handle("/", http.FileServer(http.FS(subFS))) http.HandleFunc("/ws", websocketHandler) localListener, err := net.Listen("tcp", "127.0.0.1:0")