Merge pull request #29 from michaelbirdflyt/master
update to go-github v30.1.0
This commit is contained in:
commit
5766a1046b
6
go.mod
6
go.mod
|
@ -2,17 +2,13 @@ module github.com/rhysd/go-github-selfupdate
|
|||
|
||||
require (
|
||||
github.com/blang/semver v3.5.1+incompatible
|
||||
github.com/google/go-github v17.0.0+incompatible
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
github.com/google/go-github/v30 v30.1.0
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/onsi/gomega v1.4.2 // indirect
|
||||
github.com/tcnksm/go-gitconfig v0.1.2
|
||||
github.com/ulikunitz/xz v0.5.5
|
||||
golang.org/x/net v0.0.0-20181108082009-03003ca0c849 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect
|
||||
google.golang.org/appengine v1.3.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
)
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
|
||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
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/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo=
|
||||
github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8=
|
||||
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=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
|
||||
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/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
|
||||
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
|
||||
github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
|
||||
github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
|
||||
github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 h1:JIqe8uIcRBHXDQVvZtHwp80ai3Lw3IJAeJEs55Dc1W0=
|
||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk=
|
||||
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/google/go-github/v30/github"
|
||||
)
|
||||
|
||||
var reVersion = regexp.MustCompile(`\d+\.\d+\.\d+`)
|
||||
|
@ -69,7 +69,7 @@ func findAssetFromRelease(rel *github.RepositoryRelease,
|
|||
for _, s := range suffixes {
|
||||
if strings.HasSuffix(name, s) { // require version, arch etc
|
||||
// default: assume single artifact
|
||||
return &asset, ver, true
|
||||
return asset, ver, true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ func findAssetFromRelease(rel *github.RepositoryRelease,
|
|||
func findValidationAsset(rel *github.RepositoryRelease, validationName string) (*github.ReleaseAsset, bool) {
|
||||
for _, asset := range rel.Assets {
|
||||
if asset.GetName() == validationName {
|
||||
return &asset, true
|
||||
return asset, true
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/google/go-github/v30/github"
|
||||
)
|
||||
|
||||
func TestDetectReleaseWithVersionPrefix(t *testing.T) {
|
||||
|
@ -279,7 +279,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel1,
|
||||
TagName: &v1,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset1,
|
||||
URL: &url1,
|
||||
|
@ -296,7 +296,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &wrongAsset1,
|
||||
URL: &url11,
|
||||
|
@ -311,7 +311,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset1,
|
||||
URL: &url11,
|
||||
|
@ -328,7 +328,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset11,
|
||||
URL: &url11,
|
||||
|
@ -346,7 +346,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset11,
|
||||
URL: &url11,
|
||||
|
@ -368,7 +368,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset11,
|
||||
URL: &url11,
|
||||
|
@ -390,7 +390,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset11,
|
||||
URL: &url11,
|
||||
|
@ -415,7 +415,7 @@ func TestFindReleaseAndAsset(t *testing.T) {
|
|||
rels: &github.RepositoryRelease{
|
||||
Name: &rel11,
|
||||
TagName: &v11,
|
||||
Assets: []github.ReleaseAsset{
|
||||
Assets: []*github.ReleaseAsset{
|
||||
{
|
||||
Name: &asset11,
|
||||
URL: &url11,
|
||||
|
|
|
@ -56,7 +56,8 @@ func (up *Updater) downloadDirectlyFromURL(assetURL string) (io.ReadCloser, erro
|
|||
// It downloads a release asset via GitHub Releases API so this function is available for update releases on private repository.
|
||||
// If a redirect occurs, it fallbacks into directly downloading from the redirect URL.
|
||||
func (up *Updater) UpdateTo(rel *Release, cmdPath string) error {
|
||||
src, redirectURL, err := up.api.Repositories.DownloadReleaseAsset(up.apiCtx, rel.RepoOwner, rel.RepoName, rel.AssetID)
|
||||
var client http.Client
|
||||
src, redirectURL, err := up.api.Repositories.DownloadReleaseAsset(up.apiCtx, rel.RepoOwner, rel.RepoName, rel.AssetID, &client)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to call GitHub Releases API for getting an asset(ID: %d) for repository '%s/%s': %s", rel.AssetID, rel.RepoOwner, rel.RepoName, err)
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ func (up *Updater) UpdateTo(rel *Release, cmdPath string) error {
|
|||
return uncompressAndUpdate(bytes.NewReader(data), rel.AssetURL, cmdPath)
|
||||
}
|
||||
|
||||
validationSrc, validationRedirectURL, err := up.api.Repositories.DownloadReleaseAsset(up.apiCtx, rel.RepoOwner, rel.RepoName, rel.ValidationAssetID)
|
||||
validationSrc, validationRedirectURL, err := up.api.Repositories.DownloadReleaseAsset(up.apiCtx, rel.RepoOwner, rel.RepoName, rel.ValidationAssetID, &client)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to call GitHub Releases API for getting an validation asset(ID: %d) for repository '%s/%s': %s", rel.ValidationAssetID, rel.RepoOwner, rel.RepoName, err)
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package selfupdate
|
||||
|
||||
import (
|
||||
"github.com/blang/semver"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/blang/semver"
|
||||
)
|
||||
|
||||
func setupTestBinary() {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"os"
|
||||
"regexp"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/google/go-github/v30/github"
|
||||
gitconfig "github.com/tcnksm/go-gitconfig"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue