Skip to content

Commit

Permalink
Convert to Go Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jehiah committed Oct 8, 2019
1 parent 9febc76 commit a54693d
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor
pkg
bin
dist
git-open-pull
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
language: go
go:
- 1.8
install:
- go get github.com/constabulary/gb/...
- ./vendor.sh
- 1.13
script:
- gb test
- gb build
- go test ./...
sudo: false
notifications:
email: false
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ Create a pull request from the command line, or attach a branch to an open GitHu

$ git open-pull


### Installing


Install from source, or visit the [releases page](https://github.com/jehiah/git-open-pull/releases)

```
go get -u github.com/jehiah/git-open-pull
````
### CONFIGURATION
If available, git-open-pull will use the following config values. When not available
Expand Down Expand Up @@ -41,10 +51,8 @@ against master in the integration account
### Building From Source
This project uses [gb](https://getgb.io/) the Go Build tool, and has a `vendor.sh` to manage dependencies.
This project uses Go Modules to manage dependencies.
```
go get github.com/constabulary/gb/...
./vendor.sh
gb build
go build
```
13 changes: 6 additions & 7 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "working dir $DIR"

rm -rf $DIR/vendor
echo "... refreshing vendor directory"
./vendor.sh
if [ -e vendor ]; then
rm -rf $DIR/vendor
fi

echo "... running tests"
gb test || exit 1
go test ./... || exit 1

arch=$(go env GOARCH)
version=$(cat $DIR/src/cmd/git-open-pull/version.go | grep "const Version" | awk '{print $NF}' | sed 's/"//g')
version=$(cat $DIR/version.go | grep "const Version" | awk '{print $NF}' | sed 's/"//g')
goversion=$(go version | awk '{print $3}')

mkdir -p dist
for os in linux darwin; do
echo "... building v$version for $os/$arch"
BUILD=$(mktemp -d -t git-open-pull)
TARGET="git-open-pull-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 gb build
mkdir -p $BUILD/$TARGET
cp bin/git-open-pull-$os-$arch $BUILD/$TARGET/git-open-pull
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o $BUILD/$TARGET/git-open-pull
pushd $BUILD >/dev/null
tar czvf $TARGET.tar.gz $TARGET
if [ -e $DIR/dist/$TARGET.tar.gz ]; then
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/git-open-pull/main.go → git-open-pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"time"

"github.com/google/go-github/github"
"github.com/jehiah/git-open-pull/internal/input"
"golang.org/x/oauth2"
"input"
)

func SetupClient(ctx context.Context, s *Settings) *github.Client {
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/jehiah/git-open-pull

go 1.13

require (
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
)
17 changes: 17 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/cmd/git-open-pull/settings.go → settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"strings"

"input"
"github.com/jehiah/git-open-pull/internal/input"
)

type Settings struct {
Expand Down Expand Up @@ -102,7 +103,7 @@ func LoadSettings(ctx context.Context) (*Settings, error) {
return nil, err
}
if s.User == "" {
return nil, fmt.Errorf("GitHub username required. Set `git config --global github.user $USER`", "")
return nil, errors.New("GitHub username required. Set `git config --global github.user $USER`")
}
_, err = RunGit(ctx, "config", "--global", "github.user", s.User)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions src/cmd/git-open-pull/version.go

This file was deleted.

12 changes: 0 additions & 12 deletions vendor.sh

This file was deleted.

3 changes: 3 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

const Version = "2.0.1"

0 comments on commit a54693d

Please sign in to comment.