Skip to content

Commit

Permalink
adding fixes for linter
Browse files Browse the repository at this point in the history
fixes issues with linter
pkg/buildkit/buildkit.go:127:19: string `true` has 6 occurrences, make it a constant (goconst)
  • Loading branch information
ddl-retornam committed Jul 27, 2023
1 parent 5c63e1d commit f2e30b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions pkg/buildkit/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,20 @@ type Client struct {
func validateCompression(compression string, name string) map[string]string {
attrs := make(map[string]string)
attrs["name"] = name
const truth = "true"
switch compression {
case "estargz":
attrs["push"] = "true"
attrs["push"] = truth
attrs["compression"] = "estargz"
attrs["force-compression"] = "true"
attrs["oci-mediatypes"] = "true"
attrs["force-compression"] = truth
attrs["oci-mediatypes"] = truth
case "zstd":
attrs["compression"] = "zstd"
attrs["force-compression"] = "true"
attrs["push"] = "true"
attrs["force-compression"] = truth
attrs["push"] = truth
// default is gzip
default:
attrs["push"] = "true"
attrs["push"] = truth
}
return attrs
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/cmd/controller/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ func NewCommand() *cobra.Command {
Use: "hephaestus-controller",
Short: "OCI image build controller using buildkit",
}
cmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "hephaestus.yaml", "configuration file")
cmd.PersistentFlags().StringVarP(&config.CompressionMethod, "compression", "d", "gzip", "Compression method options: zstd,estargz")
cmd.PersistentFlags().StringVarP(&cfgFile, "config", "c",
"hephaestus.yaml", "configuration file")
cmd.PersistentFlags().StringVarP(&config.CompressionMethod,
"compression", "d", "gzip", "Compression method options: zstd,estargz")
cmd.AddCommand(
newStartCommand(),
newRunGCCommand(),
Expand Down

0 comments on commit f2e30b0

Please sign in to comment.