diff --git a/changelog.md b/changelog.md index a8fbe498c8..d53091b03c 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ ### Changes +- [#4439](https://github.com/ignite/cli/pull/4439) Simplify Ignite CLI dependencies by removing `moby` and `gorilla` dependencies. - [#4471](https://github.com/ignite/cli/pull/4471) Bump CometBFT to v0.38.15. - [#4471](https://github.com/ignite/cli/pull/4471) Bump Ignite & chain minimum Go version to 1.23. diff --git a/go.mod b/go.mod index 7742bca09c..b7c35bff96 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,6 @@ require ( github.com/golangci/golangci-lint v1.60.3 github.com/google/go-github/v48 v48.2.0 github.com/google/go-querystring v1.1.0 - github.com/gorilla/mux v1.8.1 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-plugin v1.6.0 github.com/iancoleman/strcase v0.3.0 @@ -59,7 +58,6 @@ require ( github.com/lib/pq v1.10.9 github.com/manifoldco/promptui v0.9.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/moby/moby v24.0.9+incompatible github.com/muesli/reflow v0.3.0 github.com/nqd/flat v0.2.0 github.com/otiai10/copy v1.14.0 @@ -171,8 +169,6 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.14.1 // indirect github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c // indirect - github.com/containerd/containerd v1.7.11 // indirect - github.com/containerd/log v0.1.0 // indirect github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect github.com/cosiner/argv v0.1.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect @@ -276,6 +272,7 @@ require ( github.com/gordonklaus/ineffassign v0.1.0 // indirect github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect @@ -283,6 +280,7 @@ require ( github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect @@ -348,9 +346,6 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/patternmatcher v0.6.0 // indirect - github.com/moby/sys/sequential v0.5.0 // indirect - github.com/moby/sys/user v0.1.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/morikuni/aec v1.0.0 // indirect @@ -457,6 +452,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.26.0 // indirect go.opentelemetry.io/otel/sdk v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.26.0 // indirect diff --git a/go.sum b/go.sum index 5619a6c07d..10dae692f7 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,6 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMb github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/Abirdcfly/dupword v0.0.14 h1:3U4ulkc8EUo+CaT105/GJ1BQwtgyj6+VaBVbAX11Ba8= github.com/Abirdcfly/dupword v0.0.14/go.mod h1:VKDAbxdY8YbKUByLGg8EETzYSuC4crm9WwI6Y3S0cLI= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= @@ -87,8 +85,6 @@ github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lpr github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -297,8 +293,6 @@ github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4q github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c h1:sgmd9/Gm5SFfxHSVVD7HAaEQlaUJKdJ2VlQM8SwUxvs= github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/containerd v1.7.11 h1:lfGKw3eU35sjV0aG2eYZTiwFEY1pCzxdzicHP3SZILw= -github.com/containerd/containerd v1.7.11/go.mod h1:5UluHxHTX2rdvYuZ5OJTC5m/KJNs0Zs9wVoJm9zf5ZE= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/stargz-snapshotter/estargz v0.15.1 h1:eXJjw9RbkLFgioVaTG+G/ZW/0kEe2oEKCdS/ZxIyoCU= @@ -1038,14 +1032,6 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/moby v24.0.9+incompatible h1:Z/hFbZJqC5Fmuf6jesMLdHU71CMAgdiSJ1ZYey+bFmg= -github.com/moby/moby v24.0.9+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= -github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= -github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= -github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= -github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= -github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/ignite/pkg/cosmosfaucet/http.go b/ignite/pkg/cosmosfaucet/http.go index 5664c3e5ce..c53b17ab44 100644 --- a/ignite/pkg/cosmosfaucet/http.go +++ b/ignite/pkg/cosmosfaucet/http.go @@ -3,7 +3,6 @@ package cosmosfaucet import ( "net/http" - "github.com/gorilla/mux" "github.com/rs/cors" "github.com/ignite/cli/v28/ignite/pkg/openapiconsole" @@ -12,23 +11,34 @@ import ( // ServeHTTP implements http.Handler to expose the functionality of Faucet.Transfer() via HTTP. // request/response payloads are compatible with the previous implementation at allinbits/cosmos-faucet. func (f Faucet) ServeHTTP(w http.ResponseWriter, r *http.Request) { - router := mux.NewRouter() - - router. - Handle("/", cors.Default().Handler(http.HandlerFunc(f.faucetHandler))). - Methods(http.MethodPost, http.MethodOptions) - - router. - Handle("/info", cors.Default().Handler(http.HandlerFunc(f.faucetInfoHandler))). - Methods(http.MethodGet, http.MethodOptions) - - router. - HandleFunc("/", openapiconsole.Handler("Faucet", "openapi.yml")). - Methods(http.MethodGet) - - router. - HandleFunc("/openapi.yml", f.openAPISpecHandler). - Methods(http.MethodGet) - - router.ServeHTTP(w, r) + mux := http.NewServeMux() + + mux.Handle("/", cors.Default().Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.Method == http.MethodPost || r.Method == http.MethodOptions: + f.faucetHandler(w, r) + case r.Method == http.MethodGet: + openapiconsole.Handler("Faucet", "openapi.yml")(w, r) + default: + http.NotFound(w, r) + } + }))) + + mux.Handle("/info", cors.Default().Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodGet || r.Method == http.MethodOptions { + f.faucetInfoHandler(w, r) + } else { + http.NotFound(w, r) + } + }))) + + mux.HandleFunc("/openapi.yml", func(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodGet { + f.openAPISpecHandler(w, r) + } else { + http.NotFound(w, r) + } + }) + + mux.ServeHTTP(w, r) } diff --git a/ignite/services/chain/chain_test.go b/ignite/services/chain/chain_test.go index ddfc356730..05c8b5982c 100644 --- a/ignite/services/chain/chain_test.go +++ b/ignite/services/chain/chain_test.go @@ -5,9 +5,10 @@ import ( "path/filepath" "testing" - "github.com/moby/moby/pkg/archive" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/ignite/cli/v28/ignite/pkg/archive" ) func TestSourceVersion(t *testing.T) { @@ -36,7 +37,7 @@ func tempSource(t *testing.T, tarPath string) (path string) { dir := t.TempDir() - require.NoError(t, archive.Untar(f, dir, &archive.TarOptions{NoLchown: true})) + require.NoError(t, archive.ExtractArchive(dir, f)) dirs, err := os.ReadDir(dir) require.NoError(t, err)