Skip to content

Commit bcf2c7b

Browse files
authored
🐛 Update BurntSushi/toml and emicklei/go-restful (#203)
* Update BurntSushi/toml and emicklei/go-restful * Also update in vendor/modules.txt * Fix error: unknown flag: --out-format * Remove old files from toml, go-restful/v3 * Pull in the vendored updates. * More updates from `go mod vendor`. * Remove old mods from go.sum. Signed-off-by: Kurt Garloff <[email protected]>
1 parent e07da34 commit bcf2c7b

File tree

38 files changed

+582
-1867
lines changed

38 files changed

+582
-1867
lines changed

.golangci.yml

Lines changed: 220 additions & 236 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ifeq ($(BUILD_IN_CONTAINER),true)
8484
else
8585
go version
8686
golangci-lint version
87-
golangci-lint run -v --out-format=github-actions
87+
golangci-lint run -v # --out-format=github-actions
8888
endif
8989

9090
.PHONY: lint-yaml

csctldocker/csctldocker_main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ func main() {
6969
fmt.Printf("releaseDir: %s\n", releaseDir)
7070
fmt.Printf("nodeImageRegistry: %s\n", nodeImageRegistry)
7171
fmt.Printf("..... pretending to read config: %s\n", config.Config.Provider.Config["dummyKey"])
72-
fmt.Printf("..... pretending to do heavy work (creating node images) ...\n")
72+
fmt.Print("..... pretending to do heavy work (creating node images) ...\n")
7373
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
dario.cat/mergo v1.0.1 // indirect
2323
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
2424
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
25-
github.com/BurntSushi/toml v1.4.0 // indirect
25+
github.com/BurntSushi/toml v1.6.0 // indirect
2626
github.com/MakeNowJust/heredoc v1.0.0 // indirect
2727
github.com/Masterminds/goutils v1.1.1 // indirect
2828
github.com/Masterminds/semver/v3 v3.3.0 // indirect
@@ -46,7 +46,7 @@ require (
4646
github.com/docker/docker-credential-helpers v0.7.0 // indirect
4747
github.com/docker/go-connections v0.5.0 // indirect
4848
github.com/docker/go-metrics v0.0.1 // indirect
49-
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
49+
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
5050
github.com/emirpasic/gods v1.12.0 // indirect
5151
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
5252
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h
88
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
99
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
1010
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
11-
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
12-
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
11+
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
12+
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
1313
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
1414
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
1515
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
@@ -106,8 +106,8 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ
106106
github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw=
107107
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4=
108108
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
109-
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
110-
github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
109+
github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes=
110+
github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
111111
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
112112
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
113113
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=

pkg/clusterstack/mode.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"fmt"
2121

2222
"github.com/SovereignCloudStack/cluster-stack-operator/pkg/version"
23-
"github.com/SovereignCloudStack/csctl/pkg/hash"
23+
"github.com/SovereignCloudStack/csctl/pkg/cshash"
2424
)
2525

2626
// HandleStableMode returns metadata for the stable mode.
27-
func HandleStableMode(gitHubReleasePath string, currentReleaseHash, latestReleaseHash hash.ReleaseHash) (*MetaData, error) {
27+
func HandleStableMode(gitHubReleasePath string, currentReleaseHash, latestReleaseHash cshash.ReleaseHash) (*MetaData, error) {
2828
metadata, err := ParseMetaData(gitHubReleasePath)
2929
if err != nil {
3030
return nil, fmt.Errorf("failed to parse metadata: %w", err)
@@ -63,7 +63,7 @@ func HandleStableMode(gitHubReleasePath string, currentReleaseHash, latestReleas
6363
}
6464

6565
// HandleHashMode handles the hash mode with the cluster stack hash.
66-
func HandleHashMode(currentRelease hash.ReleaseHash, kubernetesVersion string) *MetaData {
66+
func HandleHashMode(currentRelease cshash.ReleaseHash, kubernetesVersion string) *MetaData {
6767
clusterStackHash := currentRelease.GetClusterStackHash()
6868
clusterStackHash = fmt.Sprintf("v0-sha.%s", clusterStackHash)
6969

pkg/cmd/create.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/SovereignCloudStack/csctl/pkg/assetsclient/github"
2929
"github.com/SovereignCloudStack/csctl/pkg/assetsclient/oci"
3030
"github.com/SovereignCloudStack/csctl/pkg/clusterstack"
31-
"github.com/SovereignCloudStack/csctl/pkg/hash"
31+
"github.com/SovereignCloudStack/csctl/pkg/cshash"
3232
"github.com/SovereignCloudStack/csctl/pkg/providerplugin"
3333
"github.com/SovereignCloudStack/csctl/pkg/template"
3434
"github.com/spf13/cobra"
@@ -73,8 +73,8 @@ type CreateOptions struct {
7373
ClusterStackReleaseDir string
7474
Config *clusterstack.CsctlConfig
7575
Metadata *clusterstack.MetaData
76-
CurrentReleaseHash hash.ReleaseHash
77-
LatestReleaseHash hash.ReleaseHash
76+
CurrentReleaseHash cshash.ReleaseHash
77+
LatestReleaseHash cshash.ReleaseHash
7878
NodeImageRegistry string
7979
releaseName string
8080
}
@@ -127,7 +127,7 @@ func GetCreateOptions(ctx context.Context, clusterStackPath string) (*CreateOpti
127127
return createOption, fmt.Errorf("providerplugin.GetProviderExecutable(&config) failed: %w", err)
128128
}
129129

130-
currentHash, err := hash.GetHash(clusterStackPath)
130+
currentHash, err := cshash.GetHash(clusterStackPath)
131131
if err != nil {
132132
return nil, fmt.Errorf("failed to get hash: %w", err)
133133
}
@@ -147,6 +147,8 @@ func GetCreateOptions(ctx context.Context, clusterStackPath string) (*CreateOpti
147147
remoteFactory = github.NewFactory()
148148
case "oci":
149149
remoteFactory = oci.NewFactory()
150+
default:
151+
return nil, errors.New("please provide a valied remote repo")
150152
}
151153

152154
ac, err := remoteFactory.NewClient(ctx)
@@ -171,7 +173,7 @@ func GetCreateOptions(ctx context.Context, clusterStackPath string) (*CreateOpti
171173
return nil, fmt.Errorf("failed to download release asset: %w", err)
172174
}
173175

174-
createOption.LatestReleaseHash, err = hash.ParseReleaseHash("./.tmp/release/hashes.json")
176+
createOption.LatestReleaseHash, err = cshash.ParseReleaseHash("./.tmp/release/hashes.json")
175177
if err != nil {
176178
return nil, fmt.Errorf("failed to read hash from the github: %w", err)
177179
}
@@ -199,6 +201,8 @@ func GetCreateOptions(ctx context.Context, clusterStackPath string) (*CreateOpti
199201
if err != nil {
200202
return nil, fmt.Errorf("failed to handle custom mode: %w", err)
201203
}
204+
default:
205+
return nil, errors.New("please use a valid mode")
202206
}
203207

204208
releaseDirName, err := clusterstack.GetClusterStackReleaseDirectoryName(createOption.Metadata, createOption.Config)

pkg/hash/hash.go renamed to pkg/cshash/hash.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package hash contains important functions of hash.
18-
package hash
17+
// Package cshash contains important functions of hash.
18+
package cshash
1919

2020
import (
2121
"crypto/sha256"
@@ -92,6 +92,9 @@ func GetHash(path string) (ReleaseHash, error) {
9292
releaseHash.ClusterAddonDir = hash
9393
case nodeImageDirName:
9494
releaseHash.NodeImageDir = hash
95+
default:
96+
// Should not happen
97+
return ReleaseHash{}, fmt.Errorf("unknown name type %s", entryPath)
9598
}
9699
} else if !entry.IsDir() && entry.Name() == clusterAddonValuesFileName {
97100
file, _ := os.Open(filepath.Clean(entryPath))

vendor/github.com/BurntSushi/toml/README.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/BurntSushi/toml/decode.go

Lines changed: 36 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)