Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
use -trimpath to build dist binary, update deps and sync template
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Jun 2, 2020
1 parent d2a0105 commit b2461dc
Show file tree
Hide file tree
Showing 43 changed files with 3,581 additions and 1,952 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/.github/ export-ignore
/bin/ export-ignore
/githooks/ export-ignore
/tools/ export-ignore

Makefile export-ignore
Expand Down
82 changes: 42 additions & 40 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,52 @@
project_name: egg

archives:
- id: egg
files:
- LICENSE
format: tar.gz
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
386: 32bit
amd64: 64bit
darwin: macOS
linux: Linux
- id: egg
files:
- LICENSE
format: tar.gz
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
386: 32bit
amd64: 64bit
darwin: macOS
linux: Linux

brews:
- name: egg
commit_author:
name: Kamil Samigullin
email: [email protected]
description: Extended go get - alternative for the standard `go get` with a few little but useful features.
folder: Formula
homepage: https://github.com/kamilsk/egg
github:
owner: kamilsk
name: homebrew-tap
install: |
bin.install "egg"
output = Utils.popen_read("#{bin}/egg completion bash")
(bash_completion/"egg").write output
output = Utils.popen_read("#{bin}/egg completion zsh")
(zsh_completion/"_egg").write output
prefix.install_metafiles
test: |
system "#{bin}/egg --version"
- name: egg
commit_author:
name: Kamil Samigullin
email: [email protected]
description: Extended go get - alternative for the standard `go get` with a few little but useful features.
folder: Formula
homepage: https://github.com/kamilsk/egg
github:
owner: kamilsk
name: homebrew-tap
install: |
bin.install "egg"
output = Utils.popen_read("#{bin}/egg completion bash")
(bash_completion/"egg").write output
output = Utils.popen_read("#{bin}/egg completion zsh")
(zsh_completion/"_egg").write output
prefix.install_metafiles
test: |
system "#{bin}/egg --version"
builds:
- binary: egg
env:
- CGO_ENABLED=0
goarch:
- 386
- amd64
goos:
- darwin
- linux
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
main: .
- binary: egg
env:
- CGO_ENABLED=0
flags:
- -trimpath
goarch:
- 386
- amd64
goos:
- darwin
- linux
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
main: .

checksum: { name_template: checksums.txt }

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ toolset:
go generate tools.go; \
)

.PHONY: hooks
hooks:
@ls .git/hooks | grep -v .sample | sed 's|.*|.git/hooks/&|' | xargs rm -f || true
@for hook in $(GIT_HOOKS); do cp githooks/$$hook .git/hooks/; done

ifdef GO_VERSIONS

define go_tpl
Expand All @@ -205,11 +210,6 @@ $(foreach version,$(GO_VERSIONS),$(render_go_tpl))

endif

.PHONY: hooks
hooks:
@ls .git/hooks | grep -v .sample | sed 's|.*|.git/hooks/&|' | xargs rm -f || true
@for hook in $(GIT_HOOKS); do cp githooks/$$hook .git/hooks/; done


.PHONY: init
init: deps test lint hooks
Expand Down
14 changes: 8 additions & 6 deletions bin/activate
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -o pipefail

deactivate () {
unset _ARCH
unset _BINPATH
Expand Down Expand Up @@ -102,12 +104,12 @@ _OS=$(uname -s | tr '[:upper:]' '[:lower:]')
_ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
_BINPATH=$(_realpath $(dirname "${BASH_SOURCE[0]:-$0}"))/"${_OS}/${_ARCH}"

_OLD_GO111MODULE="${GO111MODULE}"
_OLD_GOBIN="${GOBIN}"
_OLD_GOFLAGS="${GOFLAGS}"
_OLD_GOPRIVATE="${GOPRIVATE}"
_OLD_GOPROXY="${GOPROXY}"
_OLD_PATH="${PATH}"
_OLD_GO111MODULE="${GO111MODULE:-}"
_OLD_GOBIN="${GOBIN:-}"
_OLD_GOFLAGS="${GOFLAGS:-}"
_OLD_GOPRIVATE="${GOPRIVATE:-}"
_OLD_GOPROXY="${GOPROXY:-}"
_OLD_PATH="${PATH:-}"
_OLD_PS1="${PS1:-}"

export GO111MODULE=on
Expand Down
2 changes: 2 additions & 0 deletions githooks/post-merge
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

set -euo pipefail

make deps hooks
3 changes: 3 additions & 0 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash

set -euo pipefail

make deps-tidy deps-fetch lint format
git diff --quiet --exit-code
3 changes: 3 additions & 0 deletions githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash

set -euo pipefail

make generate
git diff --quiet --exit-code
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/izumin5210/gex v0.6.1
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v1.0.0
github.com/stretchr/testify v1.5.1
github.com/stretchr/testify v1.6.0
go.octolab.org v0.0.26
go.octolab.org/toolkit/cli v0.0.9
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
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/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
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=
Expand Down Expand Up @@ -161,4 +163,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
6 changes: 3 additions & 3 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (

// New returns the new root command.
func New() *cobra.Command {
cmd := &cobra.Command{
command := cobra.Command{
Use: "egg",
Short: "Extended go get",
Long: "Extended go get - alternative for the standard `go get` with a few little but useful features.",

SilenceErrors: false,
SilenceUsage: true,
}
cmd.AddCommand(deps.New(), make.New(), tools.New(), vanity.New())
return cmd
command.AddCommand(deps.New(), make.New(), tools.New(), vanity.New())
return &command
}
20 changes: 20 additions & 0 deletions internal/cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd_test

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

. "github.com/kamilsk/egg/internal/cmd"
)

func TestNew(t *testing.T) {
root := New()
require.NotNil(t, root)
assert.NotEmpty(t, root.Use)
assert.NotEmpty(t, root.Short)
assert.NotEmpty(t, root.Long)
assert.False(t, root.SilenceErrors)
assert.True(t, root.SilenceUsage)
}
2 changes: 1 addition & 1 deletion vendor/github.com/stretchr/testify/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b2461dc

Please sign in to comment.