From ff9f36cad363db0be73562e2791d395aca669e84 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 13 Jun 2022 10:22:51 +0200 Subject: [PATCH] Revert httpcache integration The httpcache transport is breaking authentication where no fix seems to be implemented yet. I'd propose to revert the change for now to be able to use authenticated requests in tools like `k/release/cmd/release-notes`. Refers to: https://github.com/google/go-github/issues/1503, https://github.com/gregjones/httpcache/pull/104 Signed-off-by: Sascha Grunert --- github/github.go | 11 ----------- go.mod | 2 -- go.sum | 2 -- 3 files changed, 15 deletions(-) diff --git a/github/github.go b/github/github.go index 469b0fa..3441438 100644 --- a/github/github.go +++ b/github/github.go @@ -27,8 +27,6 @@ import ( "strings" "github.com/google/go-github/v45/github" - "github.com/gregjones/httpcache" - "github.com/gregjones/httpcache/diskcache" "github.com/sirupsen/logrus" "golang.org/x/oauth2" @@ -185,15 +183,6 @@ func NewWithToken(token string) (*GitHub, error) { &oauth2.Token{AccessToken: token}, )) } - cacheDir, err := os.UserCacheDir() - if err != nil { - logrus.Infof("Unable to retrieve user cache dir: %v", err) - cacheDir = os.TempDir() - } - dir := filepath.Join(cacheDir, "kubernetes", "release-sdk", "github") - logrus.Debugf("Caching GitHub responses in %v", dir) - t := httpcache.NewTransport(diskcache.New(dir)) - client.Transport = t.Transport logrus.Debugf("Using %s GitHub client", state) return &GitHub{ diff --git a/go.mod b/go.mod index 2b744bf..767d973 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/go-git/go-git/v5 v5.4.2 github.com/google/go-containerregistry v0.9.0 github.com/google/go-github/v45 v45.1.0 - github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/magefile/mage v1.13.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.5.0 github.com/sigstore/cosign v1.9.0 @@ -176,7 +175,6 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.1 // indirect - github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/go.sum b/go.sum index ee87053..0cdd594 100644 --- a/go.sum +++ b/go.sum @@ -1180,7 +1180,6 @@ github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -1699,7 +1698,6 @@ github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterh/liner v0.0.0-20170211195444-bf27d3ba8e1d/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw=