diff --git a/.golangci.yml b/.golangci.yml index bd8283bf58..13645f65ba 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -103,6 +103,10 @@ linters-settings: gosec: excludes: - G115 + govet: + enable: + - fieldalignment + issues: exclude-dirs: diff --git a/cmd/scw/web_test.go b/cmd/scw/web_test.go index f788ef6e18..d40dabc88d 100644 --- a/cmd/scw/web_test.go +++ b/cmd/scw/web_test.go @@ -14,8 +14,8 @@ func Test_WebValidateTemplates(t *testing.T) { // Test that web urls are valid templates type failedTemplate struct { - Cmd string Err error + Cmd string } errs := []any(nil) @@ -41,8 +41,8 @@ func Test_WebValidateTemplatesVariables(t *testing.T) { // Test that web urls are valid templates type failedTemplate struct { - Cmd string Err error + Cmd string } errs := []any(nil) diff --git a/core/arg_specs.go b/core/arg_specs.go index ce03a4e6fb..ea11dcfe52 100644 --- a/core/arg_specs.go +++ b/core/arg_specs.go @@ -79,39 +79,17 @@ func (s *ArgSpecs) AddBefore(name string, argSpec *ArgSpec) { } type ArgSpec struct { - // Name of the argument. - Name string - - // Short description. - Short string - - // Required defines whether the argument is required. - Required bool - - // Default is the argument default value. - Default DefaultFunc - - // EnumValues contains all possible values of an enum. - EnumValues []string - - // AutoCompleteFunc is used to autocomplete possible values for a given argument. + Default DefaultFunc AutoCompleteFunc AutoCompleteArgFunc - - // ValidateFunc validates an argument. - ValidateFunc ArgSpecValidateFunc - - // Positional defines whether the argument is a positional argument. NB: a positional argument is required. - Positional bool - - // Only one argument of the same OneOfGroup could be specified - OneOfGroup string - - // Deprecated is used to flag an argument as deprecated. - // Use the short field to indicate migration tips for users. - Deprecated bool - - // CanLoadFile allow to use @ prefix to load a file as content - CanLoadFile bool + ValidateFunc ArgSpecValidateFunc + Name string + Short string + OneOfGroup string + EnumValues []string + Required bool + Positional bool + Deprecated bool + CanLoadFile bool } func (a *ArgSpec) Prefix() string { diff --git a/core/autocomplete.go b/core/autocomplete.go index 40b4652a65..0bb9dbe589 100644 --- a/core/autocomplete.go +++ b/core/autocomplete.go @@ -45,16 +45,14 @@ type AutoCompleteNode struct { Children map[string]*AutoCompleteNode Command *Command ArgSpec *ArgSpec + Name string Type AutoCompleteNodeType - - // Name of the current node. Useful for debugging. - Name string } type FlagSpec struct { Name string - HasVariableValue bool EnumValues []string + HasVariableValue bool } func (node *AutoCompleteNode) addFlags(flags []FlagSpec) { diff --git a/core/autocomplete_test.go b/core/autocomplete_test.go index 9dd2fefbbd..c9561ab5dc 100644 --- a/core/autocomplete_test.go +++ b/core/autocomplete_test.go @@ -80,8 +80,8 @@ func testAutocompleteGetCommands() *core.Commands { type autoCompleteTestCase struct { Suggestions core.AutocompleteSuggestions - WordToCompleteIndex int Words []string + WordToCompleteIndex int } func runAutocompleteTest(ctx context.Context, tc *autoCompleteTestCase) func(*testing.T) { diff --git a/core/bootstrap.go b/core/bootstrap.go index ed6cdab5c9..507752678a 100644 --- a/core/bootstrap.go +++ b/core/bootstrap.go @@ -18,60 +18,22 @@ import ( ) type BootstrapConfig struct { - // Args to use for the command. Usually os.Args - Args []string - - // A list of all available commands - Commands *Commands - - // BuildInfo contains information about cli build - BuildInfo *BuildInfo - - // Stdout stream to use. Usually os.Stdout - Stdout io.Writer - - // Stderr stream to use. Usually os.Stderr - Stderr io.Writer - - // Stdin stream to use. Usually os.Stdin - Stdin io.Reader - - // If provided this client will be passed to all commands. - // If not a client will be automatically created by the CLI using Config, Env and flags see createClient(). - Client *scw.Client - - // DisableTelemetry, if set to true this will disable telemetry report no matter what the config send_telemetry is set to. - // This is useful when running test to avoid sending meaningless telemetries. + Stdin io.Reader + Platform platform.Platform + Ctx context.Context + Stdout io.Writer + Stderr io.Writer + Logger *Logger + Client *scw.Client + OverrideEnv map[string]string + OverrideExec OverrideExecFunc + BuildInfo *BuildInfo + HTTPClient *http.Client + Commands *Commands + Args []string DisableTelemetry bool - - // DisableAliases, if set to true this will disable aliases expanding - DisableAliases bool - - // OverrideEnv overrides environment variables returned by core.ExtractEnv function. - // This is useful for tests as it allows overriding env without relying on global state. - OverrideEnv map[string]string - - // OverrideExec allow to override exec.Cmd.Run method. In order for this to work - // your code must call le core.ExecCmd function to execute a given command. - // If this function is not defined the exec.Cmd.Run function will be called directly. - // This function is intended to be use for tests purposes. - OverrideExec OverrideExecFunc - - // BaseContest is the base context that will be used across all function call from top to bottom. - Ctx context.Context - - // Optional we use it if defined - Logger *Logger - - // Default HTTPClient to use. If not provided it will use a basic http client with a simple retry policy - // This client will be used to create SDK client, account call, version checking and telemetry - HTTPClient *http.Client - - // Enable beta functionalities - BetaMode bool - - // The current platform, should probably be platform.Default - Platform platform.Platform + DisableAliases bool + BetaMode bool } // Bootstrap is the main entry point. It is directly called from main. diff --git a/core/cobra_utils_test.go b/core/cobra_utils_test.go index 7d9b787094..ddfed88ae3 100644 --- a/core/cobra_utils_test.go +++ b/core/cobra_utils_test.go @@ -22,8 +22,8 @@ type testDate struct { } type testAcceptMultiPositionalArgsType struct { - NameIDs []string Tag string + NameIDs []string } func testGetCommands() *core.Commands { diff --git a/core/command.go b/core/command.go index 86d806a36c..57a0fd567d 100644 --- a/core/command.go +++ b/core/command.go @@ -13,87 +13,32 @@ import ( // Command represent a CLI command. From this higher level type we create Cobra command objects. type Command struct { - // Namespace is the top level entry point of a command. (e.g scw instance) - Namespace string - - // Resource is the 2nd command level. Resources are nested in a namespace. (e.g scw instance server) - Resource string - - // Verb is the 3rd command level. Verbs are nested in a resource. (e.g scw instance server list) - Verb string - - // Short documentation. - Short string - - // Long documentation. - Long string - - // AllowAnonymousClient defines whether the SDK client can run the command without be authenticated. - AllowAnonymousClient bool - - // DisableTelemetry disable telemetry for the command. - DisableTelemetry bool - - // DisableAfterChecks disable checks that run after the command to avoid superfluous message - DisableAfterChecks bool - - // Hidden hides the command form usage and auto-complete. - Hidden bool - - // ArgsType defines the type of argument for this command. - ArgsType reflect.Type - - // ArgSpecs defines specifications for arguments. - ArgSpecs ArgSpecs - - // AcceptMultiplePositionalArgs defines whether the command can accept multiple positional arguments. - // If enabled, positional argument is expected to be a list. + ArgsType reflect.Type + Run CommandRunner + Interceptor CommandInterceptor + PreValidateFunc CommandPreValidateFunc + View *View + ValidateFunc CommandValidateFunc + WaitFunc WaitFunc + WebURL string + WaitUsage string + Resource string + Namespace string + path string + Long string + Verb string + Short string + Aliases []string + Examples []*Example + ArgSpecs ArgSpecs + SeeAlsos []*SeeAlso + Groups []string AcceptMultiplePositionalArgs bool - - // View defines the View for this command. - // It is used to create the different options for the different Marshalers. - View *View - - // Examples defines Examples for this command. - Examples []*Example - - // SeeAlsos presents commands related to this command. - SeeAlsos []*SeeAlso - - // PreValidateFunc allows to manipulate args before validation - PreValidateFunc CommandPreValidateFunc - - // ValidateFunc validates a command. - // If nil, core.DefaultCommandValidateFunc is used by default. - ValidateFunc CommandValidateFunc - - // Interceptor are middleware func that can intercept context and args before they are sent to Run - // You can combine multiple CommandInterceptor using AddInterceptors method. - Interceptor CommandInterceptor - - // Run will be called to execute a command. It will receive a context and parsed argument. - // Non-nil values returned by this method will be printed out. - Run CommandRunner - - // WaitFunc will be called if non-nil when the -w (--wait) flag is passed. - WaitFunc WaitFunc - - // WebURL will be used as url to open when the --web flag is passed - // Can contain template of values in request, ex: "url/{{ .Zone }}/{{ .ResourceID }}" - WebURL string - - // WaitUsage override the usage for the -w (--wait) flag - WaitUsage string - - // Aliases contains a list of aliases for a command - Aliases []string - // cache command path - path string - - // Groups contains a list of groups IDs - Groups []string - // - Deprecated bool + Hidden bool + DisableAfterChecks bool + DisableTelemetry bool + AllowAnonymousClient bool + Deprecated bool } // CommandPreValidateFunc allows to manipulate args before validation. @@ -203,8 +148,8 @@ func (c *Command) MatchAlias(alias alias.Alias) bool { // Commands represent a list of CLI commands, with a index to allow searching. type Commands struct { - commands []*Command commandIndex map[string]*Command + commands []*Command } func NewCommands(cmds ...*Command) *Commands { diff --git a/core/context.go b/core/context.go index ac8f2040fa..1f272d64af 100644 --- a/core/context.go +++ b/core/context.go @@ -15,26 +15,23 @@ import ( // Meta store globally available variables like sdk client or global Flags. type Meta struct { - BinaryName string - - ProfileFlag string - ConfigPathFlag string - Logger *Logger - - BuildInfo *BuildInfo - Client *scw.Client - Commands *Commands - OverrideEnv map[string]string - OverrideExec OverrideExecFunc - CliConfig *cliConfig.Config - Platform platform.Platform - - command *Command - stdout io.Writer - stderr io.Writer - stdin io.Reader + Platform platform.Platform result interface{} + stdin io.Reader + stderr io.Writer + stdout io.Writer + BuildInfo *BuildInfo httpClient *http.Client + OverrideEnv map[string]string + OverrideExec OverrideExecFunc + CliConfig *cliConfig.Config + Client *scw.Client + command *Command + Commands *Commands + Logger *Logger + BinaryName string + ProfileFlag string + ConfigPathFlag string isClientFromBootstrapConfig bool BetaMode bool } diff --git a/core/human/marshal_func.go b/core/human/marshal_func.go index 9419c6a36d..388de3b2a9 100644 --- a/core/human/marshal_func.go +++ b/core/human/marshal_func.go @@ -207,11 +207,8 @@ func isMarshalable(t reflect.Type) bool { // EnumMarshalSpec contains specs used by EnumMarshalFunc. type EnumMarshalSpec struct { - // Attribute (mainly colors) to use. + Value string Attribute color.Attribute - - // Value is the value that will be printed for the given value. - Value string } type EnumMarshalSpecs map[interface{}]*EnumMarshalSpec diff --git a/core/human/marshal_test.go b/core/human/marshal_test.go index 4115f2c8d1..13acc328dc 100644 --- a/core/human/marshal_test.go +++ b/core/human/marshal_test.go @@ -14,19 +14,19 @@ import ( ) type Struct struct { - String string - Int int - Bool bool - Strings []string + Stringer Stringer Time time.Time - Struct *Struct Nil *Struct - Structs []*Struct + Struct *Struct Map map[string]string - Stringer Stringer StringerPtr *Stringer Size *scw.Size + String string + Strings []string + Structs []*Struct Bytes []byte + Int int + Bool bool } type StructAny struct { @@ -47,10 +47,10 @@ type Acquaintance struct { } type Human struct { - Name string - Age int Address *Address + Name string Acquaintances []*Acquaintance + Age int } type NestedAnonymous struct { diff --git a/core/human/specs.go b/core/human/specs.go index a03b24117c..9d332c4804 100644 --- a/core/human/specs.go +++ b/core/human/specs.go @@ -8,15 +8,11 @@ import ( // MarshalOpt is hydrated by core.View type MarshalOpt struct { - Title string - Fields []*MarshalFieldOpt - Sections []*MarshalSection - SubOptions map[string]*MarshalOpt - - // Is set to true if we are marshaling a table cell - TableCell bool - - // DisableShrinking will disable columns shrinking based on terminal size + SubOptions map[string]*MarshalOpt + Title string + Fields []*MarshalFieldOpt + Sections []*MarshalSection + TableCell bool DisableShrinking bool } diff --git a/core/printer.go b/core/printer.go index f128599d35..3cdfd8d010 100644 --- a/core/printer.go +++ b/core/printer.go @@ -42,9 +42,9 @@ const ( ) type PrinterConfig struct { - OutputFlag string Stdout io.Writer Stderr io.Writer + OutputFlag string } // NewPrinter returns an initialized formatter corresponding to a given FormatterType. @@ -133,18 +133,12 @@ func setupWidePrinter(printer *Printer, opts string) { } type Printer struct { - printerType PrinterType stdout io.Writer stderr io.Writer - - // Enable pretty print on json output - jsonPretty bool - - // go template to use on template output - template *template.Template - - // Allow to select specifics column in a table with human printer + template *template.Template + printerType PrinterType humanFields []string + jsonPretty bool } func (p *Printer) Print(data interface{}, opt *human.MarshalOpt) error { diff --git a/core/reflect_test.go b/core/reflect_test.go index a015a41cb7..d7e1613c6b 100644 --- a/core/reflect_test.go +++ b/core/reflect_test.go @@ -38,8 +38,8 @@ type SpecialRequest struct { } type EndpointSpecPrivateNetwork struct { - PrivateNetworkID string ServiceIP *scw.IPNet + PrivateNetworkID string } type PrivateNetwork struct { @@ -63,9 +63,9 @@ func Test_getValuesForFieldByName(t *testing.T) { } tests := []struct { + testFunc func(*testing.T, TestCase) name string testCase TestCase - testFunc func(*testing.T, TestCase) }{ { name: "Simple test", diff --git a/core/result.go b/core/result.go index bb196ea718..e8e0529a92 100644 --- a/core/result.go +++ b/core/result.go @@ -13,13 +13,12 @@ import ( ) type SuccessResult struct { - Message string - Details string - Resource string - Verb string - Empty bool - // Used to pass resource to an AfterFunc on success TargetResource any + Message string + Details string + Resource string + Verb string + Empty bool } // This type can be return by a command that need to output specific content on stdout directly. diff --git a/core/shell.go b/core/shell.go index 8af5a4228f..646c6a5185 100644 --- a/core/shell.go +++ b/core/shell.go @@ -25,9 +25,9 @@ type Completer struct { } type ShellSuggestion struct { - Text string Arg *ArgSpec Cmd *Command + Text string } // lastArg returns last element of string or empty string diff --git a/core/testing.go b/core/testing.go index 25d03b786a..640fb10aff 100644 --- a/core/testing.go +++ b/core/testing.go @@ -50,34 +50,16 @@ var ( // CheckFuncCtx contain the result of a command execution type CheckFuncCtx struct { - // Exit code return by the CLI - ExitCode int - - // Content print on stdout - Stdout []byte - - // Content print on stderr - Stderr []byte - - // Error returned by the command - Err error - - // Command result - Result interface{} - - // Meta bag - Meta TestMetadata - - // Scaleway client - Client *scw.Client - - // OverrideEnv passed in the TestConfig + Err error + Result interface{} + Meta TestMetadata + Client *scw.Client OverrideEnv map[string]string - - Logger *Logger - - // The content logged by the command - LogBuffer string + Logger *Logger + LogBuffer string + Stdout []byte + Stderr []byte + ExitCode int } var testRenderHelpers = map[string]any{ @@ -142,70 +124,25 @@ type AfterFuncCtx struct { // TestConfig contain configuration that can be used with the Test function type TestConfig struct { - // Array of command to load (see main.go) - Commands *Commands - - // If set to true the client will be initialize to use a e2e token. - UseE2EClient bool - - // DefaultRegion to use with scw client (default: scw.RegionFrPar) - DefaultRegion scw.Region - - // DefaultZone to use with scw client (default: scw.ZoneFrPar1) - DefaultZone scw.Zone - - // BeforeFunc is a hook that will be called before test is run. You can use this function to bootstrap resources. - BeforeFunc BeforeFunc - - // The command line you want to test - // The arguments in this command MUST have only one space between each others to be split successfully - // Conflict with Args - Cmd string - - // Args represents a program arguments and should be used, when you cannot Cmd because your arguments include space characters - // Conflict with Cmd - Args []string - - // A list of check function that will be run on result. - Check TestCheck - - // AfterFunc is a hook that will be called after test is run. You can use this function to teardown resources. - AfterFunc AfterFunc - - // Run tests in parallel. - DisableParallel bool - - // Fake build info for this test. - BuildInfo *BuildInfo - - // If set, it will create a temporary home directory during the tests. - // Get this folder with ExtractUserHomeDir() - // This will also use this temporary directory as a cache directory. - // Get this folder with ExtractCacheDir() - TmpHomeDir bool - - // OverrideEnv contains environment variables that will be overridden during the test. - OverrideEnv map[string]string - - // see BootstrapConfig.OverrideExec - OverrideExec OverrideExecTestFunc - - // Custom client to use for test, if none are provided will create one automatically - Client *scw.Client - - // Context that will be forwarded to Bootstrap - Ctx context.Context - - // If this is specified this value will be passed to interactive.InjectMockResponseToContext ans will allow - // to mock response a user would have enter in a prompt. - // Warning: All prompts MUST be mocked or test will hang. + Ctx context.Context + Stdin io.Reader + AfterFunc AfterFunc + BuildInfo *BuildInfo + BeforeFunc BeforeFunc + Client *scw.Client + OverrideExec OverrideExecTestFunc + Check TestCheck + Commands *Commands + OverrideEnv map[string]string + DefaultRegion scw.Region + Cmd string + DefaultZone scw.Zone + Args []string PromptResponseMocks []string - - // Allow to mock stdin - Stdin io.Reader - - // EnabledAliases enables aliases that are disabled in tests - EnableAliases bool + TmpHomeDir bool + DisableParallel bool + UseE2EClient bool + EnableAliases bool } // getTestFilePath returns a valid filename path based on the go test name and suffix. (Take care of non fs friendly char) diff --git a/core/validate_test.go b/core/validate_test.go index c41f2fddc5..08a4931aa3 100644 --- a/core/validate_test.go +++ b/core/validate_test.go @@ -12,11 +12,11 @@ import ( ) type Element struct { - ID int - Name string ElementsMap map[string]Element - ElementsSlice []Element FirstNestedElement *FirstNestedElement + Name string + ElementsSlice []Element + ID int } type FirstNestedElement struct { @@ -296,9 +296,9 @@ func Test_DefaultCommandRequiredFunc(t *testing.T) { func Test_ValidateNoConflict(t *testing.T) { type TestCase struct { command *core.Command - rawArgs args.RawArgs arg1 string arg2 string + rawArgs args.RawArgs } runOK := func(testCase TestCase) func(t *testing.T) { @@ -385,9 +385,9 @@ func TestNewOneOfGroupManager(t *testing.T) { } tests := []struct { - name string testCase TestCase testFunc func(*testing.T, TestCase) + name string }{ { name: "Basic OneOf Groups", @@ -488,11 +488,11 @@ func TestNewOneOfGroupManager(t *testing.T) { func TestValidateRequiredOneOfGroups(t *testing.T) { tests := []struct { - name string + ArgsType interface{} setupManager func() *core.OneOfGroupManager - rawArgs args.RawArgs + name string expectedError string - ArgsType interface{} + rawArgs args.RawArgs }{ { name: "Required group satisfied with first argument", @@ -558,11 +558,11 @@ func TestValidateRequiredOneOfGroups(t *testing.T) { func TestValidateUniqueOneOfGroups(t *testing.T) { tests := []struct { - name string + ArgsType interface{} setupManager func() *core.OneOfGroupManager - rawArgs args.RawArgs + name string expectedError string - ArgsType interface{} + rawArgs args.RawArgs }{ { name: "Required group satisfied with first argument", diff --git a/internal/args/args_test.go b/internal/args/args_test.go index 5386f9fc97..358dfb728d 100644 --- a/internal/args/args_test.go +++ b/internal/args/args_test.go @@ -14,17 +14,17 @@ import ( ) type Basic struct { + StringPtr *string String string Int int - Int16 int16 - Int32 int32 Int64 int64 - UInt16 uint16 - UInt32 uint32 UInt64 uint64 - Float32 float32 Float64 float64 - StringPtr *string + Int32 int32 + UInt32 uint32 + Float32 float32 + Int16 int16 + UInt16 uint16 Bool bool } @@ -36,8 +36,8 @@ type Slice struct { } type WellKnownTypes struct { - Size scw.Size Time time.Time + Size scw.Size } type Nested struct { @@ -90,10 +90,10 @@ type Enum struct { } type RecursiveWithMapOfRecursive struct { - ID int + Elements map[string]*RecursiveWithMapOfRecursive Name string Short string - Elements map[string]*RecursiveWithMapOfRecursive + ID int } func (c *CustomStruct) UnmarshalArgs(value string) error { @@ -168,8 +168,8 @@ func TestGetArgType(t *testing.T) { type TestCase struct { ArgType reflect.Type Name string - ExpectedKind reflect.Kind expectedError string + ExpectedKind reflect.Kind } run := func(tc *TestCase) func(*testing.T) { diff --git a/internal/args/errors.go b/internal/args/errors.go index 81c910811f..9cecb9225d 100644 --- a/internal/args/errors.go +++ b/internal/args/errors.go @@ -47,14 +47,9 @@ func (e *NotMarshalableTypeError) Error() string { // type UnmarshalArgError struct { - // ArgName is the name of the argument which causes the error. - ArgName string - - // ArgValue is the value of the argument which causes the error. + Err error + ArgName string ArgValue string - - // Err is the wrapped error. - Err error } func (e *UnmarshalArgError) Error() string { @@ -185,9 +180,9 @@ func missingIndices(index, length int) string { } type CannotParseDateError struct { - ArgValue string AbsoluteTimeParseError error RelativeTimeParseError error + ArgValue string } func (e *CannotParseDateError) Error() string { diff --git a/internal/args/marshal_test.go b/internal/args/marshal_test.go index d30bc48c07..8173a5f6f8 100644 --- a/internal/args/marshal_test.go +++ b/internal/args/marshal_test.go @@ -12,9 +12,9 @@ import ( func TestMarshal(t *testing.T) { type TestCase struct { + data interface{} error string expected []string - data interface{} } stringPtr := "test" @@ -230,9 +230,9 @@ func TestMarshal(t *testing.T) { func TestMarshalValue(t *testing.T) { type TestCase struct { + data interface{} error string expected string - data interface{} } run := func(testCase TestCase) func(t *testing.T) { diff --git a/internal/args/unmarshal_test.go b/internal/args/unmarshal_test.go index 570d175ec5..449f9502df 100644 --- a/internal/args/unmarshal_test.go +++ b/internal/args/unmarshal_test.go @@ -18,10 +18,10 @@ func init() { func TestUnmarshalStruct(t *testing.T) { type TestCase struct { - args []string - error string expected interface{} data interface{} + error string + args []string } stringPtr := "test" @@ -536,8 +536,8 @@ func TestUnmarshalStruct(t *testing.T) { func TestIsUmarshalableValue(t *testing.T) { type TestCase struct { - expected bool data interface{} + expected bool } run := func(testCase TestCase) func(t *testing.T) { diff --git a/internal/editor/editor.go b/internal/editor/editor.go index fae7768ff9..e146bce83a 100644 --- a/internal/editor/editor.go +++ b/internal/editor/editor.go @@ -17,23 +17,11 @@ var ( type ( GetResourceFunc func(interface{}) (interface{}, error) Config struct { - // PutRequest means that the request replace all fields - // If false, fields that were not edited will not be sent - // If true, all fields will be sent - PutRequest bool - - MarshalMode MarshalMode - - // Template is a template that will be shown before marshaled data in edited file - Template string - - // IgnoreFields is a list of json tags that will be removed from marshaled data - // The content of these fields will be lost in edited data - IgnoreFields []string - - // If not empty, this will replace edited text as if it was edited in the terminal - // Should be paired with global SkipEditor as true, useful for tests + MarshalMode MarshalMode + Template string EditedResource string + IgnoreFields []string + PutRequest bool } ) diff --git a/internal/editor/editor_test.go b/internal/editor/editor_test.go index a72b8c739b..1891d7fc87 100644 --- a/internal/editor/editor_test.go +++ b/internal/editor/editor_test.go @@ -34,8 +34,8 @@ func Test_updateResourceEditor_pointers(t *testing.T) { editor.SkipEditor = true type UpdateRequest struct { - ID string Name *string + ID string } resource := &struct { ID string @@ -62,12 +62,12 @@ func Test_updateResourceEditor_map(t *testing.T) { editor.SkipEditor = true type UpdateRequest struct { - ID string `json:"id"` Env *map[string]string `json:"env"` + ID string `json:"id"` } resource := &struct { - ID string `json:"id"` Env map[string]string `json:"env"` + ID string `json:"id"` }{ "uuid", map[string]string{ diff --git a/internal/gofields/gofields_test.go b/internal/gofields/gofields_test.go index 19a79a7d34..02cf8d26b1 100644 --- a/internal/gofields/gofields_test.go +++ b/internal/gofields/gofields_test.go @@ -30,17 +30,17 @@ type Address struct { } type User struct { - Name string Address *Address - Friends []*Friends Pets map[string]*Pet + Name string + Friends []*Friends } func TestGetValue(t *testing.T) { type TestCase struct { Data interface{} - Path string Expected interface{} + Path string } run := func(tc *TestCase) func(*testing.T) { @@ -149,8 +149,8 @@ func TestGetValue(t *testing.T) { func TestGetType(t *testing.T) { type TestCase struct { Data reflect.Type - Path string Expected interface{} + Path string } run := func(tc *TestCase) func(*testing.T) { @@ -246,8 +246,8 @@ func TestListFields(t *testing.T) { func TestListFieldsWithFilter(t *testing.T) { type TestCase struct { Data reflect.Type - Expected []string Filter gofields.ListFieldFilter + Expected []string } run := func(tc *TestCase) func(*testing.T) { diff --git a/internal/interactive/prompt.go b/internal/interactive/prompt.go index 42868b6557..a96762c7fa 100644 --- a/internal/interactive/prompt.go +++ b/internal/interactive/prompt.go @@ -63,10 +63,10 @@ func PromptBoolWithConfig(config *PromptBoolConfig) (bool, error) { type PromptStringConfig struct { Ctx context.Context + ValidateFunc ValidateFunc Prompt string DefaultValue string DefaultValueDoc string - ValidateFunc ValidateFunc } func PromptStringWithConfig(config *PromptStringConfig) (string, error) { @@ -102,11 +102,11 @@ func (h *ReadlineHandler) SetPrompt(prompt string) { type ReadlineConfig struct { Ctx context.Context - Prompt string PromptFunc func(string) string - Password bool ValidateFunc ValidateFunc + Prompt string DefaultValue string + Password bool } func Readline(config *ReadlineConfig) (string, error) { diff --git a/internal/namespaces/applesilicon/v1alpha1/custom_server_ssh.go b/internal/namespaces/applesilicon/v1alpha1/custom_server_ssh.go index 928a41a185..c204359b56 100644 --- a/internal/namespaces/applesilicon/v1alpha1/custom_server_ssh.go +++ b/internal/namespaces/applesilicon/v1alpha1/custom_server_ssh.go @@ -17,8 +17,8 @@ type serverSSHConnectRequest struct { Zone scw.Zone ServerID string Username string - Port uint Command string + Port uint } func serverSSHCommand() *core.Command { diff --git a/internal/namespaces/autocomplete/autocomplete.go b/internal/namespaces/autocomplete/autocomplete.go index 07100baf5f..cb64014e64 100644 --- a/internal/namespaces/autocomplete/autocomplete.go +++ b/internal/namespaces/autocomplete/autocomplete.go @@ -46,9 +46,9 @@ func autocompleteRootCommand() *core.Command { } type autocompleteScript struct { + ShellConfigurationFile map[string]string CompleteScript string CompleteFunc string - ShellConfigurationFile map[string]string } // autocompleteScripts regroups the autocomplete scripts for the different shells diff --git a/internal/namespaces/baremetal/v1/custom_server_create.go b/internal/namespaces/baremetal/v1/custom_server_create.go index b41bdf2b35..c0a24cc445 100644 --- a/internal/namespaces/baremetal/v1/custom_server_create.go +++ b/internal/namespaces/baremetal/v1/custom_server_create.go @@ -12,21 +12,14 @@ import ( func serverCreateBuilder(c *core.Command) *core.Command { type baremetalCreateServerRequestCustom struct { - Zone scw.Zone `json:"-"` - // OrganizationID with which the server will be created OrganizationID *string `json:"organization_id"` - // ProjectID with which the server will be created - ProjectID *string `json:"project_id"` - // Name of the server (≠hostname) - Name string `json:"name"` - // Description associated to the server, max 255 characters - Description string `json:"description"` - // Tags associated with the server - Tags []string `json:"tags"` - // Type of the server - Type string - // Installation configuration - Install *baremetal.CreateServerRequestInstall + ProjectID *string `json:"project_id"` + Install *baremetal.CreateServerRequestInstall + Zone scw.Zone `json:"-"` + Name string `json:"name"` + Description string `json:"description"` + Type string + Tags []string `json:"tags"` } c.ArgsType = reflect.TypeOf(baremetalCreateServerRequestCustom{}) diff --git a/internal/namespaces/baremetal/v1/custom_server_fip.go b/internal/namespaces/baremetal/v1/custom_server_fip.go index 81cb1fb3e2..7e88c09552 100644 --- a/internal/namespaces/baremetal/v1/custom_server_fip.go +++ b/internal/namespaces/baremetal/v1/custom_server_fip.go @@ -16,8 +16,8 @@ type serverAddFlexibleIPRequest struct { ServerID string Description string IPType string - Tags []string Zone scw.Zone + Tags []string } func serverAddFlexibleIP() *core.Command { diff --git a/internal/namespaces/block/v1alpha1/custom_snapshot.go b/internal/namespaces/block/v1alpha1/custom_snapshot.go index 8c2391f7a6..44fc743002 100644 --- a/internal/namespaces/block/v1alpha1/custom_snapshot.go +++ b/internal/namespaces/block/v1alpha1/custom_snapshot.go @@ -16,11 +16,10 @@ const ( ) type snapshotWaitRequest struct { - Zone scw.Zone - SnapshotID string - Timeout time.Duration - TerminalStatus *block.SnapshotStatus + Zone scw.Zone + SnapshotID string + Timeout time.Duration } func snapshotWaitCommand() *core.Command { diff --git a/internal/namespaces/block/v1alpha1/custom_volume.go b/internal/namespaces/block/v1alpha1/custom_volume.go index c032687dcc..106769929d 100644 --- a/internal/namespaces/block/v1alpha1/custom_volume.go +++ b/internal/namespaces/block/v1alpha1/custom_volume.go @@ -16,11 +16,10 @@ const ( ) type volumeWaitRequest struct { - Zone scw.Zone - VolumeID string - Timeout time.Duration - TerminalStatus *block.VolumeStatus + Zone scw.Zone + VolumeID string + Timeout time.Duration } func volumeWaitCommand() *core.Command { diff --git a/internal/namespaces/config/commands.go b/internal/namespaces/config/commands.go index 7a6c7a9a84..bb852e4e26 100644 --- a/internal/namespaces/config/commands.go +++ b/internal/namespaces/config/commands.go @@ -628,9 +628,9 @@ func configInfoCommand() *core.Command { } return struct { + Profile map[string]any ConfigPath string ProfileName string - Profile map[string]any }{ ConfigPath: core.ExtractConfigPath(ctx), ProfileName: core.ExtractProfileName(ctx), diff --git a/internal/namespaces/container/v1beta1/custom_deploy.go b/internal/namespaces/container/v1beta1/custom_deploy.go index ebd7ccb680..006d936db0 100644 --- a/internal/namespaces/container/v1beta1/custom_deploy.go +++ b/internal/namespaces/container/v1beta1/custom_deploy.go @@ -33,20 +33,16 @@ import ( ) type containerDeployRequest struct { - Region scw.Region - - Name string - + BuildArgs map[string]*string + NamespaceID *string + Region scw.Region + Name string Builder string Dockerfile string + BuildSource string + Port uint32 ForceBuilder bool - - BuildSource string - Cache bool - BuildArgs map[string]*string - - NamespaceID *string - Port uint32 + Cache bool } func containerDeployCommand() *core.Command { @@ -231,10 +227,10 @@ func DeployStepFetchOrCreateRegistry(t *tasks.Task, data *DeployStepCreateNamesp } type DeployStepPackImageResponse struct { + Tar io.Reader *DeployStepData Namespace *container.Namespace RegistryEndpoint string - Tar io.Reader } func DeployStepDockerPackImage(_ *tasks.Task, data *DeployStepFetchOrCreateResponse) (*DeployStepPackImageResponse, error) { @@ -252,10 +248,10 @@ func DeployStepDockerPackImage(_ *tasks.Task, data *DeployStepFetchOrCreateRespo } type DeployStepBuildImageResponse struct { - *DeployStepData - Namespace *container.Namespace - Tag string DockerClient DockerClient + *DeployStepData + Namespace *container.Namespace + Tag string } func DeployStepDockerBuildImage(t *tasks.Task, data *DeployStepPackImageResponse) (*DeployStepBuildImageResponse, error) { diff --git a/internal/namespaces/documentdb/v1beta1/custom_engine.go b/internal/namespaces/documentdb/v1beta1/custom_engine.go index 038696384d..ded3c500a3 100644 --- a/internal/namespaces/documentdb/v1beta1/custom_engine.go +++ b/internal/namespaces/documentdb/v1beta1/custom_engine.go @@ -10,9 +10,9 @@ import ( func engineListBuilder(c *core.Command) *core.Command { type customEngine struct { + EndOfLife *time.Time `json:"end_of_life"` Name string `json:"name"` EngineType string `json:"engine_type"` - EndOfLife *time.Time `json:"end_of_life"` } c.View = &core.View{ diff --git a/internal/namespaces/domain/v2beta1/custom_record_add.go b/internal/namespaces/domain/v2beta1/custom_record_add.go index 26a5b0f2b0..ff8c43eccb 100644 --- a/internal/namespaces/domain/v2beta1/custom_record_add.go +++ b/internal/namespaces/domain/v2beta1/custom_record_add.go @@ -10,8 +10,8 @@ import ( ) type dnsRecordAddRequest struct { - DNSZone string *domain.Record + DNSZone string } func dnsRecordAddCommand() *core.Command { diff --git a/internal/namespaces/domain/v2beta1/custom_record_set.go b/internal/namespaces/domain/v2beta1/custom_record_set.go index c779301199..32c8d99ae4 100644 --- a/internal/namespaces/domain/v2beta1/custom_record_set.go +++ b/internal/namespaces/domain/v2beta1/custom_record_set.go @@ -11,9 +11,9 @@ import ( ) type dnsRecordSetRequest struct { + *domain.Record DNSZone string Values []string - *domain.Record } func dnsRecordSetCommand() *core.Command { diff --git a/internal/namespaces/feedback/issue.go b/internal/namespaces/feedback/issue.go index 71c019726f..a256b1f373 100644 --- a/internal/namespaces/feedback/issue.go +++ b/internal/namespaces/feedback/issue.go @@ -27,8 +27,8 @@ const ( ) type issue struct { - IssueTemplate issueTemplate BuildInfo *core.BuildInfo + IssueTemplate issueTemplate } const bugBodyTemplate = ` diff --git a/internal/namespaces/iam/v1alpha1/custom_rule.go b/internal/namespaces/iam/v1alpha1/custom_rule.go index 7dc168c1fa..7eba73a254 100644 --- a/internal/namespaces/iam/v1alpha1/custom_rule.go +++ b/internal/namespaces/iam/v1alpha1/custom_rule.go @@ -11,8 +11,8 @@ import ( ) type iamRuleCreateCommandRequest struct { - PolicyID string iam.RuleSpecs + PolicyID string } func iamRuleCreateCommand() *core.Command { diff --git a/internal/namespaces/init/init.go b/internal/namespaces/init/init.go index bf9ffa6748..5d97073ef0 100644 --- a/internal/namespaces/init/init.go +++ b/internal/namespaces/init/init.go @@ -58,16 +58,15 @@ func GetCommands() *core.Commands { } type Args struct { - AccessKey string - SecretKey string - ProjectID string - OrganizationID string - - Region scw.Region - Zone scw.Zone SendTelemetry *bool WithSSHKey *bool InstallAutocomplete *bool + AccessKey string + SecretKey string + ProjectID string + OrganizationID string + Region scw.Region + Zone scw.Zone } func Command() *core.Command { diff --git a/internal/namespaces/instance/v1/args_test.go b/internal/namespaces/instance/v1/args_test.go index b4648a3f23..faf5618244 100644 --- a/internal/namespaces/instance/v1/args_test.go +++ b/internal/namespaces/instance/v1/args_test.go @@ -14,10 +14,10 @@ type NullableStringValueRequest struct { func TestNullableStringValueUnmarshal(t *testing.T) { type testCase struct { - args []string data interface{} expectedStruct interface{} expectedError error + args []string } run := func(tc *testCase) func(t *testing.T) { diff --git a/internal/namespaces/instance/v1/custom_image.go b/internal/namespaces/instance/v1/custom_image.go index 7825e3b3d0..19b46883a3 100644 --- a/internal/namespaces/instance/v1/custom_image.go +++ b/internal/namespaces/instance/v1/custom_image.go @@ -34,19 +34,19 @@ var ( func imagesMarshalerFunc(i interface{}, _ *human.MarshalOpt) (string, error) { type humanImage struct { - ID string - Name string - State instance.ImageState - Public bool + CreationDate *time.Time + ModificationDate *time.Time + OrganizationID string Zone scw.Zone - Volumes []scw.Size ServerName string ServerID string Arch instance.Arch - OrganizationID string + ID string ProjectID string - CreationDate *time.Time - ModificationDate *time.Time + State instance.ImageState + Name string + Volumes []scw.Size + Public bool } images := i.([]*imageListItem) @@ -98,10 +98,10 @@ func imagesMarshalerFunc(i interface{}, _ *human.MarshalOpt) (string, error) { func imageCreateBuilder(c *core.Command) *core.Command { type customCreateImageRequest struct { *instance.CreateImageRequest - AdditionalVolumes []*instance.VolumeTemplate - SnapshotID string OrganizationID *string ProjectID *string + SnapshotID string + AdditionalVolumes []*instance.VolumeTemplate } c.ArgSpecs.GetByName("extra-volumes.{key}.id").Short = "UUID of the snapshot to add" diff --git a/internal/namespaces/instance/v1/custom_security_group.go b/internal/namespaces/instance/v1/custom_security_group.go index 2670158958..3a7ec450c6 100644 --- a/internal/namespaces/instance/v1/custom_security_group.go +++ b/internal/namespaces/instance/v1/custom_security_group.go @@ -83,17 +83,17 @@ func marshalSecurityGroupRules(i interface{}, _ *human.MarshalOpt) (out string, // MarshalHuman marshals a customSecurityGroupResponse. func (sg *customSecurityGroupResponse) MarshalHuman() (out string, err error) { humanSecurityGroup := struct { + OrganizationDefault *bool + CreationDate *time.Time + ModificationDate *time.Time ID string Name string State instance.SecurityGroupState Description string - EnableDefaultSecurity bool OrganizationID string ProjectID string - OrganizationDefault *bool + EnableDefaultSecurity bool ProjectDefault bool - CreationDate *time.Time - ModificationDate *time.Time Stateful bool }{ ID: sg.ID, diff --git a/internal/namespaces/instance/v1/custom_server.go b/internal/namespaces/instance/v1/custom_server.go index 5866885936..5142f78ba0 100644 --- a/internal/namespaces/instance/v1/custom_server.go +++ b/internal/namespaces/instance/v1/custom_server.go @@ -58,26 +58,26 @@ func serverLocationMarshalerFunc(i interface{}, _ *human.MarshalOpt) (string, er func serversMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { // humanServerInList is the custom Server type used for list view. type humanServerInList struct { - ID string + PrivateIP *string + CreationDate *time.Time + ModificationDate *time.Time + PlacementGroup *instance.PlacementGroup + RoutedIPEnabled *bool + SecurityGroupName string Name string - Type string - State instance.ServerState + ImageID string + ImageName string Zone scw.Zone + State instance.ServerState + Type string + Arch instance.Arch + StateDetail string + SecurityGroupID string + ID string PublicIP net.IP - PrivateIP *string Tags []string - ImageName string - RoutedIPEnabled *bool - PlacementGroup *instance.PlacementGroup - ModificationDate *time.Time - CreationDate *time.Time Volumes int Protected bool - SecurityGroupName string - SecurityGroupID string - StateDetail string - Arch instance.Arch - ImageID string } servers := i.([]*instance.Server) diff --git a/internal/namespaces/instance/v1/custom_server_action.go b/internal/namespaces/instance/v1/custom_server_action.go index 8933321125..7a845f9de3 100644 --- a/internal/namespaces/instance/v1/custom_server_action.go +++ b/internal/namespaces/instance/v1/custom_server_action.go @@ -242,8 +242,8 @@ Once your image is ready you will be able to create a new server based on this i type customTerminateServerRequest struct { Zone scw.Zone ServerID string - WithIP bool WithBlock withBlock + WithIP bool } type withBlock string diff --git a/internal/namespaces/instance/v1/custom_server_create.go b/internal/namespaces/instance/v1/custom_server_create.go index 51c4209e5b..66330ff5c4 100644 --- a/internal/namespaces/instance/v1/custom_server_create.go +++ b/internal/namespaces/instance/v1/custom_server_create.go @@ -18,34 +18,26 @@ import ( ) type instanceCreateServerRequest struct { - Zone scw.Zone - ProjectID *string - Image string - Type string - Name string - RootVolume string - AdditionalVolumes []string - IP string - DynamicIPRequired *bool - Tags []string - IPv6 bool - Stopped bool - SecurityGroupID string - PlacementGroupID string - - // Windows + DynamicIPRequired *bool + ProjectID *string + OrganizationID *string + RoutedIPEnabled *bool AdminPasswordEncryptionSSHKeyID *string - - // IP Mobility - RoutedIPEnabled *bool - - // Deprecated - BootscriptID string - CloudInit string - BootType string - - // Deprecated: use project-id instead - OrganizationID *string + RootVolume string + Type string + IP string + Zone scw.Zone + Image string + BootType string + CloudInit string + SecurityGroupID string + PlacementGroupID string + Name string + BootscriptID string + AdditionalVolumes []string + Tags []string + Stopped bool + IPv6 bool } func serverCreateCommand() *core.Command { diff --git a/internal/namespaces/instance/v1/custom_server_create_builder.go b/internal/namespaces/instance/v1/custom_server_create_builder.go index 1e1ca3c1d2..3b88cf8e32 100644 --- a/internal/namespaces/instance/v1/custom_server_create_builder.go +++ b/internal/namespaces/instance/v1/custom_server_create_builder.go @@ -19,26 +19,15 @@ import ( ) type ServerBuilder struct { - // createdReq is the request being built - createReq *instance.CreateServerRequest - // createIPReqs is filled with requests if one or more IP are needed - createIPReqs []*instance.CreateIPRequest - - // volumes is the list of requested volumes - volumes []*VolumeBuilder - - // rootVolume is the builder for the root volume - rootVolume *VolumeBuilder - - // All needed APIs + createReq *instance.CreateServerRequest + rootVolume *VolumeBuilder apiMarketplace *marketplace.API apiInstance *instance.API apiBlock *block.API - - // serverType is filled with the ServerType if CommercialType is found in the API. - serverType *instance.ServerType - // serverImage is filled with the Image if one is provided - serverImage *instance.Image + serverType *instance.ServerType + serverImage *instance.Image + createIPReqs []*instance.CreateIPRequest + volumes []*VolumeBuilder } // NewServerBuilder creates a new builder for a server with requested commercialType in given zone. @@ -507,17 +496,12 @@ func (sb *ServerBuilder) BuildPostCreationSetup() PostServerCreationSetupFunc { } type VolumeBuilder struct { + SnapshotID *string + VolumeID *string + Size *scw.Size + IOPS *uint32 Zone scw.Zone VolumeType instance.VolumeVolumeType - - // SnapshotID is the ID of the snapshot the volume should be created from. - SnapshotID *string - // VolumeID is the ID of the volume if one should be imported. - VolumeID *string - // Size is the size of the created Volume. If used, the volume should be created from scratch. - Size *scw.Size - // IOPS is the io per second to be configured for a created volume. - IOPS *uint32 } // NewVolumeBuilder creates a volume builder from a 'volumes' argument item. diff --git a/internal/namespaces/instance/v1/custom_server_ssh.go b/internal/namespaces/instance/v1/custom_server_ssh.go index a668e1b2e6..2f6ce47978 100644 --- a/internal/namespaces/instance/v1/custom_server_ssh.go +++ b/internal/namespaces/instance/v1/custom_server_ssh.go @@ -17,8 +17,8 @@ type instanceSSHServerRequest struct { Zone scw.Zone ServerID string Username string - Port uint64 Command string + Port uint64 } func serverSSHCommand() *core.Command { diff --git a/internal/namespaces/instance/v1/custom_server_type.go b/internal/namespaces/instance/v1/custom_server_type.go index 8615a0d978..cc2cd55c39 100644 --- a/internal/namespaces/instance/v1/custom_server_type.go +++ b/internal/namespaces/instance/v1/custom_server_type.go @@ -58,14 +58,14 @@ func serverTypeListBuilder(c *core.Command) *core.Command { c.Run = func(ctx context.Context, argsI interface{}) (interface{}, error) { type customServerType struct { - Name string `json:"name"` HourlyPrice *scw.Money `json:"hourly_price"` - LocalVolumeMaxSize scw.Size `json:"local_volume_max_size"` - CPU uint32 `json:"cpu"` GPU *uint64 `json:"gpu"` - RAM scw.Size `json:"ram"` + Name string `json:"name"` Arch instance.Arch `json:"arch"` Availability instance.ServerTypesAvailability `json:"availability"` + LocalVolumeMaxSize scw.Size `json:"local_volume_max_size"` + RAM scw.Size `json:"ram"` + CPU uint32 `json:"cpu"` } api := instance.NewAPI(core.ExtractClient(ctx)) diff --git a/internal/namespaces/instance/v1/custom_ssh_config.go b/internal/namespaces/instance/v1/custom_ssh_config.go index 9ab3355b15..3f74c1c311 100644 --- a/internal/namespaces/instance/v1/custom_ssh_config.go +++ b/internal/namespaces/instance/v1/custom_ssh_config.go @@ -38,8 +38,8 @@ func (s sshConfigServer) InPrivateNetwork(id string) bool { } type sshConfigInstallRequest struct { - Zone scw.Zone ProjectID *string + Zone scw.Zone } func sshConfigInstallCommand() *core.Command { diff --git a/internal/namespaces/instance/v1/custom_volume_type.go b/internal/namespaces/instance/v1/custom_volume_type.go index 76e55e5869..bd0bd501c2 100644 --- a/internal/namespaces/instance/v1/custom_volume_type.go +++ b/internal/namespaces/instance/v1/custom_volume_type.go @@ -10,8 +10,8 @@ import ( func volumeTypeListBuilder(cmd *core.Command) *core.Command { type customVolumeType struct { - Type string `json:"type"` instance.VolumeType + Type string `json:"type"` } cmd.AddInterceptors(func(ctx context.Context, argsI interface{}, runner core.CommandRunner) (interface{}, error) { diff --git a/internal/namespaces/k8s/v1/custom_cluster.go b/internal/namespaces/k8s/v1/custom_cluster.go index c1eed4d006..39a7a2f032 100644 --- a/internal/namespaces/k8s/v1/custom_cluster.go +++ b/internal/namespaces/k8s/v1/custom_cluster.go @@ -261,12 +261,12 @@ func clusterGetBuilder(c *core.Command) *core.Command { Status k8s.PoolStatus `json:"status"` Version string `json:"version"` NodeType string `json:"node_type"` + Zone scw.Zone `json:"zone"` MinSize uint32 `json:"min_size"` Size uint32 `json:"size"` MaxSize uint32 `json:"max_size"` Autoscaling bool `json:"autoscaling"` Autohealing bool `json:"autohealing"` - Zone scw.Zone `json:"zone"` } customPools := []customPool{} diff --git a/internal/namespaces/k8s/v1/custom_execcredentials.go b/internal/namespaces/k8s/v1/custom_execcredentials.go index 4a0422f0be..e2e4259215 100644 --- a/internal/namespaces/k8s/v1/custom_execcredentials.go +++ b/internal/namespaces/k8s/v1/custom_execcredentials.go @@ -70,18 +70,9 @@ func k8sExecCredentialRun(ctx context.Context, _ interface{}) (i interface{}, e // ExecCredential is used by exec-based plugins to communicate credentials to HTTP transports. type ExecCredential struct { - // APIVersion defines the versioned schema of this representation of an object. - // Servers should convert recognized schemas to the latest internal value, and - // may reject unrecognized values. - APIVersion string `json:"apiVersion,omitempty"` - - // Kind is a string value representing the REST resource this object represents. - // Servers may infer this from the endpoint the client submits requests to. - Kind string `json:"kind,omitempty"` - - // Status is filled in by the plugin and holds the credentials that the transport - // should use to contact the API. - Status *ExecCredentialStatus `json:"status,omitempty"` + Status *ExecCredentialStatus `json:"status,omitempty"` + APIVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` } // ExecCredentialStatus holds credentials for the transport to use. diff --git a/internal/namespaces/k8s/v1/types/types.go b/internal/namespaces/k8s/v1/types/types.go index 622c06559d..9b7a3ca320 100644 --- a/internal/namespaces/k8s/v1/types/types.go +++ b/internal/namespaces/k8s/v1/types/types.go @@ -52,48 +52,20 @@ type Config struct { } type Preferences struct { - // +optional - Colors bool `json:"colors,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional Extensions []NamedExtension `json:"extensions,omitempty"` + Colors bool `json:"colors,omitempty"` } // Cluster contains information about how to communicate with a kubernetes cluster type Cluster struct { - // Server is the address of the kubernetes cluster (https://hostname:port). - Server string `json:"server"` - // TLSServerName is used to check server certificate. If TLSServerName is empty, the hostname used to contact the server is used. - // +optional - TLSServerName string `json:"tls-server-name,omitempty"` - // InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure. - // +optional - InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"` - // CertificateAuthority is the path to a cert file for the certificate authority. - // +optional - CertificateAuthority string `json:"certificate-authority,omitempty"` - // CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority - // +optional - CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` - // ProxyURL is the URL to the proxy to be used for all requests made by this - // client. URLs with "http", "https", and "socks5" schemes are supported. If - // this configuration is not provided or the empty string, the client - // attempts to construct a proxy configuration from http_proxy and - // https_proxy environment variables. If these environment variables are not - // set, the client does not attempt to proxy requests. - // - // socks5 proxying does not currently support spdy streaming endpoints (exec, - // attach, port forward). - // +optional - ProxyURL string `json:"proxy-url,omitempty"` - // DisableCompression allows client to opt-out of response compression for all requests to the server. This is useful - // to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on - // compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296. - // +optional - DisableCompression bool `json:"disable-compression,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` + Server string `json:"server"` + TLSServerName string `json:"tls-server-name,omitempty"` + CertificateAuthority string `json:"certificate-authority,omitempty"` + ProxyURL string `json:"proxy-url,omitempty"` + CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` + Extensions []NamedExtension `json:"extensions,omitempty"` + InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"` + DisableCompression bool `json:"disable-compression,omitempty"` } // AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are. @@ -185,16 +157,14 @@ type NamedAuthInfo struct { // NamedExtension relates nicknames to extension information type NamedExtension struct { - // Name is the nickname for this Extension - Name string `json:"name"` - // Extension holds the extension information Extension interface{} `json:"extension"` + Name string `json:"name"` } // AuthProviderConfig holds the configuration for a specified auth provider. type AuthProviderConfig struct { - Name string `json:"name"` Config map[string]string `json:"config"` + Name string `json:"name"` } // ExecConfig specifies a command to provide client credentials. The command is exec'd @@ -203,44 +173,13 @@ type AuthProviderConfig struct { // See the client.authentication.k8s.io API group for specifications of the exact input // and output format type ExecConfig struct { - // Command to execute. - Command string `json:"command"` - // Arguments to pass to the command when executing it. - // +optional - Args []string `json:"args"` - // Env defines additional environment variables to expose to the process. These - // are unioned with the host's environment, as well as variables client-go uses - // to pass argument to the plugin. - // +optional - Env []ExecEnvVar `json:"env"` - - // Preferred input version of the ExecInfo. The returned ExecCredentials MUST use - // the same encoding version as the input. - APIVersion string `json:"apiVersion,omitempty"` - - // This text is shown to the user when the executable doesn't seem to be - // present. For example, `brew install foo-cli` might be a good InstallHint for - // foo-cli on Mac OS systems. - InstallHint string `json:"installHint,omitempty"` - - // ProvideClusterInfo determines whether or not to provide cluster information, - // which could potentially contain very large CA data, to this exec plugin as a - // part of the KUBERNETES_EXEC_INFO environment variable. By default, it is set - // to false. Package k8s.io/client-go/tools/auth/exec provides helper methods for - // reading this environment variable. - ProvideClusterInfo bool `json:"provideClusterInfo"` - - // InteractiveMode determines this plugin's relationship with standard input. Valid - // values are "Never" (this exec plugin never uses standard input), "IfAvailable" (this - // exec plugin wants to use standard input if it is available), or "Always" (this exec - // plugin requires standard input to function). See ExecInteractiveMode values for more - // details. - // - // If APIVersion is client.authentication.k8s.io/v1alpha1 or - // client.authentication.k8s.io/v1beta1, then this field is optional and defaults - // to "IfAvailable" when unset. Otherwise, this field is required. - //+optional - InteractiveMode ExecInteractiveMode `json:"interactiveMode,omitempty"` + Command string `json:"command"` + APIVersion string `json:"apiVersion,omitempty"` + InstallHint string `json:"installHint,omitempty"` + InteractiveMode ExecInteractiveMode `json:"interactiveMode,omitempty"` + Args []string `json:"args"` + Env []ExecEnvVar `json:"env"` + ProvideClusterInfo bool `json:"provideClusterInfo"` } // ExecEnvVar is used for setting environment variables when executing an exec-based diff --git a/internal/namespaces/lb/v1/custom_backend.go b/internal/namespaces/lb/v1/custom_backend.go index 1eed1b00f0..2b0a051666 100644 --- a/internal/namespaces/lb/v1/custom_backend.go +++ b/internal/namespaces/lb/v1/custom_backend.go @@ -67,9 +67,9 @@ func backendCreateBuilder(c *core.Command) *core.Command { lb.ZonedAPICreateBackendRequest InstanceServerID []string BaremetalServerID []string - UseInstanceServerPublicIP bool InstanceServerTag []string BaremetalServerTag []string + UseInstanceServerPublicIP bool } c.ArgsType = reflect.TypeOf(lbBackendCreateRequestCustom{}) @@ -263,9 +263,9 @@ func backendAddServersBuilder(c *core.Command) *core.Command { lb.ZonedAPIAddBackendServersRequest InstanceServerID []string BaremetalServerID []string - UseInstanceServerPublicIP bool InstanceServerTag []string BaremetalServerTag []string + UseInstanceServerPublicIP bool } c.ArgsType = reflect.TypeOf(lbBackendAddBackendServersRequestCustom{}) @@ -432,9 +432,9 @@ func backendRemoveServersBuilder(c *core.Command) *core.Command { lb.ZonedAPIRemoveBackendServersRequest InstanceServerID []string BaremetalServerID []string - UseInstanceServerPublicIP bool InstanceServerTag []string BaremetalServerTag []string + UseInstanceServerPublicIP bool } c.ArgsType = reflect.TypeOf(lbBackendRemoveBackendServersRequestCustom{}) @@ -601,9 +601,9 @@ func backendSetServersBuilder(c *core.Command) *core.Command { lb.ZonedAPISetBackendServersRequest InstanceServerID []string BaremetalServerID []string - UseInstanceServerPublicIP bool InstanceServerTag []string BaremetalServerTag []string + UseInstanceServerPublicIP bool } c.ArgsType = reflect.TypeOf(lbBackendSetBackendServersRequestCustom{}) diff --git a/internal/namespaces/lb/v1/custom_lb.go b/internal/namespaces/lb/v1/custom_lb.go index 021dcc25fd..a7b75a081b 100644 --- a/internal/namespaces/lb/v1/custom_lb.go +++ b/internal/namespaces/lb/v1/custom_lb.go @@ -149,8 +149,8 @@ func lbGetBuilder(c *core.Command) *core.Command { func lbUpdateBuilder(c *core.Command) *core.Command { type lbUpdateRequestCustom struct { *lb.ZonedAPIUpdateLBRequest - AssignFlexibleIPv6 bool `json:"assign_flexible_ipv6"` IPID string `json:"ip_id"` + AssignFlexibleIPv6 bool `json:"assign_flexible_ipv6"` } c.ArgsType = reflect.TypeOf(lbUpdateRequestCustom{}) diff --git a/internal/namespaces/lb/v1/custom_private_network.go b/internal/namespaces/lb/v1/custom_private_network.go index febd74d84d..066ba1011b 100644 --- a/internal/namespaces/lb/v1/custom_private_network.go +++ b/internal/namespaces/lb/v1/custom_private_network.go @@ -15,13 +15,13 @@ func lbPrivateNetworksMarshalerFunc(i interface{}, opt *human.MarshalOpt) (strin } type customPrivateNetwork struct { - IpamIDs []string `json:"ipam_ids,omitempty"` DHCPConfigIPID *string `json:"dhcp_config_ip_id,omitempty"` StaticConfigIPAddress *[]string `json:"static_config_ip_address,omitempty"` - PrivateNetworkID string `json:"private_network_id"` - Status lb.PrivateNetworkStatus `json:"status"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` + PrivateNetworkID string `json:"private_network_id"` + Status lb.PrivateNetworkStatus `json:"status"` + IpamIDs []string `json:"ipam_ids,omitempty"` } customPrivateNetworks := make([]customPrivateNetwork, 0, len(privateNetworks)) diff --git a/internal/namespaces/login/webcallback/webcallback.go b/internal/namespaces/login/webcallback/webcallback.go index 272c03411f..ca27d9f527 100644 --- a/internal/namespaces/login/webcallback/webcallback.go +++ b/internal/namespaces/login/webcallback/webcallback.go @@ -15,12 +15,11 @@ import ( // WebCallback is a web server that will wait for a callback type WebCallback struct { - port int - + listener net.Listener tokenChan chan string errChan chan error srv *http.Server - listener net.Listener + port int } func New(opts ...Options) *WebCallback { diff --git a/internal/namespaces/object/v1/custom_bucket.go b/internal/namespaces/object/v1/custom_bucket.go index a3d4f3c816..e9f046fb88 100644 --- a/internal/namespaces/object/v1/custom_bucket.go +++ b/internal/namespaces/object/v1/custom_bucket.go @@ -19,9 +19,9 @@ import ( type bucketConfigArgs struct { Region scw.Region Name string + ACL string Tags []string EnableVersioning bool `json:"enable-versioning"` - ACL string } func bucketCreateCommand() *core.Command { diff --git a/internal/namespaces/object/v1/custom_marshaler.go b/internal/namespaces/object/v1/custom_marshaler.go index 1414b4c873..6ebd30a44d 100644 --- a/internal/namespaces/object/v1/custom_marshaler.go +++ b/internal/namespaces/object/v1/custom_marshaler.go @@ -42,10 +42,10 @@ type bucketInfo struct { Region scw.Region APIEndpoint string BucketEndpoint string - EnableVersioning bool + Owner string Tags []types.Tag ACL []CustomS3ACLGrant - Owner string + EnableVersioning bool } func bucketInfoMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { diff --git a/internal/namespaces/object/v1/s3configfile.go b/internal/namespaces/object/v1/s3configfile.go index 28f54582e2..4a00032949 100644 --- a/internal/namespaces/object/v1/s3configfile.go +++ b/internal/namespaces/object/v1/s3configfile.go @@ -32,11 +32,11 @@ func (s supportedTool) ToStringArray() []string { } type s3config struct { + ctx context.Context AccessKey string SecretKey string Region scw.Region Name string - ctx context.Context } const ( @@ -146,8 +146,8 @@ func (c s3config) getConfigFile(tool s3tool) (core.RawResult, error) { API string `json:"api"` } m := struct { - Version string `json:"version"` Hosts map[string]hostconfig `json:"hosts"` + Version string `json:"version"` }{ Version: "9", Hosts: map[string]hostconfig{ diff --git a/internal/namespaces/rdb/v1/custom_acl.go b/internal/namespaces/rdb/v1/custom_acl.go index 7e7c549fa1..b908a0f17c 100644 --- a/internal/namespaces/rdb/v1/custom_acl.go +++ b/internal/namespaces/rdb/v1/custom_acl.go @@ -21,13 +21,13 @@ var aclRuleActionMarshalSpecs = human.EnumMarshalSpecs{ type rdbACLCustomArgs struct { Region scw.Region InstanceID string - ACLRuleIPs scw.IPNet Description string + ACLRuleIPs scw.IPNet } type CustomACLResult struct { - Rules []*rdb.ACLRule Success core.SuccessResult + Rules []*rdb.ACLRule } func rdbACLCustomResultMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { diff --git a/internal/namespaces/rdb/v1/custom_backup.go b/internal/namespaces/rdb/v1/custom_backup.go index cd7a99ae3d..b05b12b70f 100644 --- a/internal/namespaces/rdb/v1/custom_backup.go +++ b/internal/namespaces/rdb/v1/custom_backup.go @@ -128,19 +128,19 @@ func backupRestoreBuilder(c *core.Command) *core.Command { func backupListBuilder(c *core.Command) *core.Command { type customBackup struct { - ID string `json:"ID"` - InstanceID string `json:"instance_ID"` - DatabaseName string `json:"database_name"` - Name string `json:"name"` - Status rdb.DatabaseBackupStatus `json:"status"` Size *scw.Size `json:"size"` - ExpiresAt *time.Time `json:"expires_at"` - CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` + CreatedAt *time.Time `json:"created_at"` + ExpiresAt *time.Time `json:"expires_at"` + Name string `json:"name"` + Status rdb.DatabaseBackupStatus `json:"status"` + ID string `json:"ID"` + DatabaseName string `json:"database_name"` + InstanceID string `json:"instance_ID"` InstanceName string `json:"instance_name"` + Region scw.Region `json:"region"` IsExported bool `json:"is_exported"` URLExpired bool `json:"url_expired"` - Region scw.Region `json:"region"` SameRegion bool `json:"same_region"` } @@ -258,8 +258,8 @@ func getDefaultFileName(rawURL string) (string, error) { } type backupDownloadResult struct { - Size scw.Size `json:"size"` FileName string `json:"file_name"` + Size scw.Size `json:"size"` } func backupResultMarshallerFunc(i interface{}, _ *human.MarshalOpt) (string, error) { diff --git a/internal/namespaces/rdb/v1/custom_endpoint.go b/internal/namespaces/rdb/v1/custom_endpoint.go index 0673540e2e..0df4fd1709 100644 --- a/internal/namespaces/rdb/v1/custom_endpoint.go +++ b/internal/namespaces/rdb/v1/custom_endpoint.go @@ -13,8 +13,8 @@ import ( ) type rdbEndpointCustomResult struct { - Endpoints []*rdb.Endpoint Success core.SuccessResult + Endpoints []*rdb.Endpoint } func rdbEndpointCustomResultMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { @@ -48,8 +48,8 @@ type rdbEndpointSpecPrivateNetworkCustom struct { func endpointCreateBuilder(c *core.Command) *core.Command { type rdbCreateEndpointRequestCustom struct { *rdb.CreateEndpointRequest - LoadBalancer bool `json:"load-balancer"` PrivateNetwork *rdbEndpointSpecPrivateNetworkCustom `json:"private-network"` + LoadBalancer bool `json:"load-balancer"` } c.ArgsType = reflect.TypeOf(rdbCreateEndpointRequestCustom{}) diff --git a/internal/namespaces/rdb/v1/custom_engine.go b/internal/namespaces/rdb/v1/custom_engine.go index 8a4dca1f95..f68d16975e 100644 --- a/internal/namespaces/rdb/v1/custom_engine.go +++ b/internal/namespaces/rdb/v1/custom_engine.go @@ -10,9 +10,9 @@ import ( func engineListBuilder(c *core.Command) *core.Command { type customEngine struct { + EndOfLife *time.Time `json:"end_of_life"` Name string `json:"name"` EngineType string `json:"engine_type"` - EndOfLife *time.Time `json:"end_of_life"` } c.View = &core.View{ diff --git a/internal/namespaces/rdb/v1/custom_instance.go b/internal/namespaces/rdb/v1/custom_instance.go index 560ecd09c3..c8ca433c78 100644 --- a/internal/namespaces/rdb/v1/custom_instance.go +++ b/internal/namespaces/rdb/v1/custom_instance.go @@ -641,12 +641,12 @@ func instanceWaitCommand() *core.Command { } type instanceConnectArgs struct { + Database *string + CliDB *string Region scw.Region - PrivateNetwork bool InstanceID string Username string - Database *string - CliDB *string + PrivateNetwork bool } type engineFamily string diff --git a/internal/namespaces/rdb/v1/custom_user.go b/internal/namespaces/rdb/v1/custom_user.go index 343b4dbe3a..fb0a7f6681 100644 --- a/internal/namespaces/rdb/v1/custom_user.go +++ b/internal/namespaces/rdb/v1/custom_user.go @@ -16,12 +16,12 @@ func userListBuilder(c *core.Command) *core.Command { c.Interceptor = func(ctx context.Context, argsI interface{}, runner core.CommandRunner) (interface{}, error) { type customUser struct { Name string `json:"name"` - IsAdmin bool `json:"is_admin"` ReadOnly []string `json:"readonly"` ReadWrite []string `json:"readwrite"` All []string `json:"all"` Custom []string `json:"custom"` None []string `json:"none"` + IsAdmin bool `json:"is_admin"` } resI, err := runner(ctx, argsI) diff --git a/internal/namespaces/registry/v1/custom_image.go b/internal/namespaces/registry/v1/custom_image.go index 4f23ab7eaf..997eec79cf 100644 --- a/internal/namespaces/registry/v1/custom_image.go +++ b/internal/namespaces/registry/v1/custom_image.go @@ -26,9 +26,9 @@ var ( ) type customImage struct { - registry.Image FullName string ExplicitVisibility string `json:"-"` + registry.Image } func imageGetBuilder(c *core.Command) *core.Command { diff --git a/internal/namespaces/secret/v1beta1/custom.go b/internal/namespaces/secret/v1beta1/custom.go index a71939edbf..2b63db500b 100644 --- a/internal/namespaces/secret/v1beta1/custom.go +++ b/internal/namespaces/secret/v1beta1/custom.go @@ -6,9 +6,9 @@ import ( ) type customAccessSecretVersionRequest struct { - secret.AccessSecretVersionRequest Field *string - Raw bool + secret.AccessSecretVersionRequest + Raw bool } func GetCommands() *core.Commands { diff --git a/internal/namespaces/vpc/v2/custom_private_network.go b/internal/namespaces/vpc/v2/custom_private_network.go index 116106fd64..70073c9820 100644 --- a/internal/namespaces/vpc/v2/custom_private_network.go +++ b/internal/namespaces/vpc/v2/custom_private_network.go @@ -166,11 +166,11 @@ type customInstanceServer struct { MacAddress string `json:"mac"` } type customBaremetalServer struct { + Vlan *uint32 `json:"vlan"` ID string `json:"id"` Name string `json:"name"` State baremetal.ServerStatus `json:"state"` BaremetalNetworkID string `json:"baremetal_network_id"` - Vlan *uint32 `json:"vlan"` } type customK8sCluster struct { ID string `json:"id"` diff --git a/internal/pkg/shlex/shlex.go b/internal/pkg/shlex/shlex.go index d98308bce3..8275e843f8 100644 --- a/internal/pkg/shlex/shlex.go +++ b/internal/pkg/shlex/shlex.go @@ -20,22 +20,21 @@ shell-style rules for quoting and commenting. The basic use case uses the default ASCII lexer to split a string into sub-strings: - shlex.Split("one \"two three\" four") -> []string{"one", "two three", "four"} + shlex.Split("one \"two three\" four") -> []string{"one", "two three", "four"} To process a stream of strings: - l := NewLexer(os.Stdin) - for ; token, err := l.Next(); err != nil { - // process token - } + l := NewLexer(os.Stdin) + for ; token, err := l.Next(); err != nil { + // process token + } To access the raw token stream (which includes tokens for comments): - t := NewTokenizer(os.Stdin) - for ; token, err := t.Next(); err != nil { - // process token - } - + t := NewTokenizer(os.Stdin) + for ; token, err := t.Next(); err != nil { + // process token + } */ package shlex @@ -57,8 +56,8 @@ type lexerState int // Token is a (type, value) pair representing a lexographical token. type Token struct { - tokenType TokenType value string + tokenType TokenType } // Equal reports whether tokens a, and b, are equal. @@ -168,8 +167,8 @@ func (l *Lexer) Next() (string, error) { // Tokenizer turns an input stream into a sequence of typed tokens type Tokenizer struct { - input bufio.Reader classifier tokenClassifier + input bufio.Reader } // NewTokenizer creates a new tokenizer from an input stream. diff --git a/internal/platform/terminal/terminal.go b/internal/platform/terminal/terminal.go index 8970192ff7..51cd42c3b7 100644 --- a/internal/platform/terminal/terminal.go +++ b/internal/platform/terminal/terminal.go @@ -6,9 +6,8 @@ import ( ) type Platform struct { + cfg *scw.Config UserAgent string - - cfg *scw.Config } func (p *Platform) ScwConfig() *scw.Config { diff --git a/internal/sshconfig/bastion_host.go b/internal/sshconfig/bastion_host.go index c8e2360249..d44a2ab017 100644 --- a/internal/sshconfig/bastion_host.go +++ b/internal/sshconfig/bastion_host.go @@ -5,9 +5,8 @@ import "fmt" type BastionHost struct { Name string Address string + Hosts []SimpleHost Port uint32 - - Hosts []SimpleHost } func (b BastionHost) Config() string { diff --git a/internal/tabwriter/tabwriter.go b/internal/tabwriter/tabwriter.go index e8927310ed..0314aa0646 100644 --- a/internal/tabwriter/tabwriter.go +++ b/internal/tabwriter/tabwriter.go @@ -88,21 +88,18 @@ type cell struct { // of one line may depend on the cells in future lines. Clients must // call Flush when done calling Write. type Writer struct { - // configuration output io.Writer + buf []byte + lines [][]cell + widths []int + cell cell minwidth int tabwidth int padding int - padbytes [8]byte flags uint - - // current state - buf []byte // collected text excluding tabs or line breaks - pos int // buffer position up to which cell.width of incomplete cell has been computed - cell cell // current incomplete cell; cell.width is up to buf[pos] excluding ignored sections - endChar byte // terminating char of escaped sequence (Escape for escapes, '>', ';' for HTML tags/entities, or 0) - lines [][]cell // list of lines; each line is a list of cells - widths []int // list of column widths in runes - re-used during formatting + pos int + padbytes [8]byte + endChar byte } // addLine adds a new line. diff --git a/internal/tabwriter/tabwriter_test.go b/internal/tabwriter/tabwriter_test.go index 454fa0ff03..7db8e3cc72 100644 --- a/internal/tabwriter/tabwriter_test.go +++ b/internal/tabwriter/tabwriter_test.go @@ -99,11 +99,14 @@ func check(t *testing.T, testname string, minwidth, tabwidth, padding int, padch } var tests = []struct { - testname string - minwidth, tabwidth, padding int - padchar byte - flags uint - src, expected string + testname string + src string + expected string + minwidth int + tabwidth int + padding int + flags uint + padchar byte }{ { "1a", diff --git a/internal/tasks/tasks.go b/internal/tasks/tasks.go index a8b413eb1e..7bee7d49fa 100644 --- a/internal/tasks/tasks.go +++ b/internal/tasks/tasks.go @@ -27,9 +27,8 @@ type Task struct { } type Tasks struct { - tasks []*Task - LoggerMode LoggerMode + tasks []*Task } func Begin() *Tasks {