Skip to content

Commit

Permalink
Merge pull request tcnksm#112 from tcnksm/gomod
Browse files Browse the repository at this point in the history
introduce go modules
  • Loading branch information
Songmu authored Apr 29, 2019
2 parents ebafc74 + ac73906 commit f1556d2
Show file tree
Hide file tree
Showing 481 changed files with 1,603 additions and 230,083 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
language: go
sudo: false
go:
- 1.10.x
- 1.11.x
- 1.x
env:
global:
- secure: "c7Owhq9NWblgnQLvmkssks3j4zNPCvgkkagVcuz3GmhcklVrZqY3H57FNepT3pkTYt+EJgqocBoohZodVFXsn917DcrMHETO6enDLUvmsJTTdxVFIU6ylr79NLTfNSJFY//gCe3WiMPw7bEePrAP1o2zMCvK21bZoHN6r48VHgY="
os:
- linux
- osx
install:
- echo "skipping travis default"
script:
- make test-all
after_script:
- goveralls
1,466 changes: 1,466 additions & 0 deletions CREDITS

Large diffs are not rendered by default.

163 changes: 0 additions & 163 deletions Gopkg.lock

This file was deleted.

66 changes: 0 additions & 66 deletions Gopkg.toml

This file was deleted.

76 changes: 46 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,67 +1,83 @@
VERSION = $(shell gobump show -r)
COMMIT = $(shell git describe --always)
VERSION = $(shell godzil show-version)
COMMIT = $(shell git rev-parse --short HEAD)
EXTERNAL_TOOLS = \
github.com/Songmu/goxz/cmd/goxz \
github.com/motemen/gobump \
github.com/Songmu/ghch/cmd/ghch
golang.org/x/lint/golint \
github.com/Songmu/godzil/cmd/godzil \
github.com/mattn/goveralls \
github.com/Songmu/gocredits/cmd/gocredits \
golang.org/x/tools/cmd/cover

ifdef update
u=-u
endif

export GO111MODULE=on

.PHONY: default
default: test

.PHONY: deps
deps:
go get ${u} -d
go mod tidy

# install external tools for this project
bootstrap:
.PHONY: devel-deps
devel-deps: deps
@for tool in $(EXTERNAL_TOOLS) ; do \
echo "Installing $$tool" ; \
go get $$tool; \
GO111MODULE=off go get $$tool; \
done

# build generate binary on './bin' directory.
.PHONY: build
build:
go build -ldflags "-X main.GitCommit=$(COMMIT)" -o bin/ghr

bump: bootstrap
@sh -c "'$(CURDIR)/scripts/bump.sh'"
.PHONY: bump
bump: devel-deps
godzil release

CREDITS: go.sum devel-deps
gocredits -w

crossbuild: bootstrap
.PHONY: crossbuild
crossbuild: CREDITS
goxz -pv=v${VERSION} -build-ldflags="-X main.GitCommit=${COMMIT}" \
-arch=386,amd64 -d=./pkg/dist/v${VERSION}
cd pkg/dist/v${VERSION} && shasum -a 256 * > ./v${VERSION}_SHASUMS

# install installs binary on $GOPATH/bin directory.
.PHONY: install
install:
go install -ldflags "-X main.GitCommit=$(COMMIT)"

# package runs compile.sh to run gox and zip them.
# Artifacts will be generated in './pkg' directory
package: bootstrap
@sh -c "'$(CURDIR)/scripts/package.sh'"

brew: package
go run release/main.go v$(VERSION) pkg/dist/v$(VERSION)/ghr_v$(VERSION)_darwin_amd64.zip > ../homebrew-ghr/ghr.rb

upload: build bootstrap
.PHONY: upload
upload: build devel-deps
bin/ghr -v
bin/ghr v$(VERSION) pkg/dist/v$(VERSION)

test-all: vet lint test
.PHONY: test-all
test-all: lint test

test:
.PHONY: test
test: deps
go test -v -parallel=4 ./...

.PHONY: test-race
test-race:
go test -v -race ./...

vet:
.PHONY: lint
lint: devel-deps
go vet ./...
golint -set_exit_status ./...

lint:
@go get github.com/golang/lint/golint
go list ./... | grep -v vendor | xargs -n1 golint -set_exit_status

.PHONY: cover
cover:
@go get golang.org/x/tools/cmd/cover
go test -coverprofile=cover.out
go tool cover -html cover.out
rm cover.out

release: bump package upload

.PHONY: bootstrap bump crossbuild build install package brew test test-race test-all vet lint cover release
.PHONY: release
release: bump crossbuild upload
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ $ ghr \

## Install

You can download binary from [release page](https://github.com/tcnksm/ghr/releases) and place it in `$PATH` directory.
If you are OSX user, you can use [Homebrew](http://brew.sh/):

```bash
$ brew install ghr
```

If you are in another platform, you can download binary from [release page](https://github.com/tcnksm/ghr/releases) and place it in `$PATH` directory.

Or you can use `go get` (you need to use go1.7 or later),

Expand All @@ -113,12 +119,12 @@ $ go get -u github.com/tcnksm/ghr
## Contribution

1. Fork ([https://github.com/tcnksm/ghr/fork](https://github.com/tcnksm/ghr/fork))
1. Create a feature branch
1. Commit your changes
1. Rebase your local changes against the master branch
1. Run test suite with the `make test` command and confirm that it passes
1. Run `gofmt -s`
1. Create new Pull Request
2. Create a feature branch
3. Commit your changes
4. Rebase your local changes against the master branch
5. Run test suite with the `make test` command and confirm that it passes
6. Run `gofmt -s`
7. Create new Pull Request

## Author

Expand Down
Loading

0 comments on commit f1556d2

Please sign in to comment.