diff --git a/cmd/config/set_cluster.go b/cmd/config/set_cluster.go index b92409d45..cd5fa91cd 100644 --- a/cmd/config/set_cluster.go +++ b/cmd/config/set_cluster.go @@ -142,7 +142,7 @@ func runSetCluster(o *config.ClusterOptions, rootSettings *environment.AirshipCT // Update configuration file // Just in time persistence approach if err := airconfig.PersistConfig(); err != nil { - // Some warning here , that it didnt persit the changes because of this + // Some warning here , that it didnt persist the changes because of this // Or should we float this up // What would it mean? No value. return clusterWasModified, err diff --git a/cmd/root_test.go b/cmd/root_test.go index 6f56cdf95..dc48945d7 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -60,7 +60,7 @@ func TestFlagLoading(t *testing.T) { tt := tt t.Run(tt.name, func(subTest *testing.T) { // We don't care about the output of this test, so toss - // it into a thowaway &bytes.buffer{} + // it into a throwaway &bytes.buffer{} rootCmd, settings, err := cmd.NewRootCmd(&bytes.Buffer{}) require.NoError(t, err) rootCmd.SetArgs(tt.args) diff --git a/pkg/bootstrap/cloudinit/cloud-init.go b/pkg/bootstrap/cloudinit/cloud-init.go index e85d20b3b..164475089 100644 --- a/pkg/bootstrap/cloudinit/cloud-init.go +++ b/pkg/bootstrap/cloudinit/cloud-init.go @@ -9,7 +9,7 @@ import ( const ( // TODO (dukov) This should depend on cluster api version once it is // fully available for Metal3. In other words: - // - Sectet for v1alpha1 + // - Secret for v1alpha1 // - KubeAdmConfig for v1alpha2 EphemeralClusterConfKind = "Secret" ) diff --git a/pkg/bootstrap/isogen/command.go b/pkg/bootstrap/isogen/command.go index 0c6cfeff3..80bc92dad 100644 --- a/pkg/bootstrap/isogen/command.go +++ b/pkg/bootstrap/isogen/command.go @@ -47,7 +47,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings, args []strin } // TODO (dukov) replace with the appropriate function once it's available - // in doncument module + // in document module docBundle, err := document.NewBundle(fs.MakeRealFS(), manifest.TargetPath, "") if err != nil { return err @@ -111,14 +111,14 @@ func verifyArtifacts(cfg *config.Bootstrap) error { } func generateBootstrapIso( - docBubdle document.Bundle, + docBundle document.Bundle, builder container.Container, cfg *config.Bootstrap, debug bool, ) error { cntVol := strings.Split(cfg.Container.Volume, ":")[1] log.Print("Creating cloud-init for ephemeral K8s") - userData, netConf, err := cloudinit.GetCloudData(docBubdle, document.EphemeralClusterMarker) + userData, netConf, err := cloudinit.GetCloudData(docBundle, document.EphemeralClusterMarker) if err != nil { return err } diff --git a/pkg/bootstrap/isogen/command_test.go b/pkg/bootstrap/isogen/command_test.go index 15cdaf6da..36de7bdd6 100644 --- a/pkg/bootstrap/isogen/command_test.go +++ b/pkg/bootstrap/isogen/command_test.go @@ -74,7 +74,7 @@ func TestBootstrapIso(t *testing.T) { cfg *config.Bootstrap debug bool expectedOut []string - expectdErr error + expectedErr error }{ { builder: &mockContainer{ @@ -83,7 +83,7 @@ func TestBootstrapIso(t *testing.T) { cfg: testCfg, debug: false, expectedOut: []string{expOut[0], expOut[1]}, - expectdErr: testErr, + expectedErr: testErr, }, { builder: &mockContainer{ @@ -93,7 +93,7 @@ func TestBootstrapIso(t *testing.T) { cfg: testCfg, debug: true, expectedOut: []string{expOut[0], expOut[1], expOut[2], expOut[3]}, - expectdErr: nil, + expectedErr: nil, }, { builder: &mockContainer{ @@ -104,7 +104,7 @@ func TestBootstrapIso(t *testing.T) { cfg: testCfg, debug: false, expectedOut: []string{expOut[0], expOut[1], expOut[2], expOut[4]}, - expectdErr: testErr, + expectedErr: testErr, }, } @@ -118,7 +118,7 @@ func TestBootstrapIso(t *testing.T) { assert.True(t, strings.Contains(actualOut, line)) } - assert.Equal(t, tt.expectdErr, actualErr) + assert.Equal(t, tt.expectedErr, actualErr) } } diff --git a/pkg/config/cmds_test.go b/pkg/config/cmds_test.go index 50896012c..67a2a2ff6 100644 --- a/pkg/config/cmds_test.go +++ b/pkg/config/cmds_test.go @@ -51,7 +51,7 @@ func TestValidateCluster(t *testing.T) { err = co.Validate() assert.Error(t, err) - // Invalid Cluter Type + // Invalid Cluster Type co.ClusterType = "Invalid" err = co.Validate() assert.Error(t, err) diff --git a/pkg/config/config.go b/pkg/config/config.go index f5d52a09c..f3eb315a2 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -184,7 +184,7 @@ func (c *Config) rmConfigClusterStragglers(persistIt bool) bool { for cType, cluster := range c.Clusters[clusterName].ClusterTypes { if _, found := c.kubeConfig.Clusters[cluster.NameInKubeconf]; !found { // Instead of removing it , I could add a empty entry in kubeconfig as well - // Will see what is more appropriae with use of Modules configuration + // Will see what is more appropriate with use of Modules configuration delete(c.Clusters[clusterName].ClusterTypes, cType) // If that was the last cluster type, then we @@ -333,7 +333,7 @@ func (c *Config) EnsureComplete() error { // If the file specified by ConfigFile does not exist it will create a new file. func (c *Config) PersistConfig() error { // Dont care if the file exists or not, will create if needed - // We are 100% overwriting the existsing file + // We are 100% overwriting the existing file configyaml, err := c.ToYaml() if err != nil { return err @@ -421,7 +421,7 @@ func (c *Config) GetCluster(cName, cType string) (*Cluster, error) { if !exists { return nil, ErrMissingConfig{What: fmt.Sprintf("Cluster with name '%s' of type '%s'", cName, cType)} } - // Alternative to this would be enhance Cluster.String() to embedd the appropriate kubeconfig cluster information + // Alternative to this would be enhance Cluster.String() to embed the appropriate kubeconfig cluster information cluster, exists := c.Clusters[cName].ClusterTypes[cType] if !exists { return nil, ErrMissingConfig{What: fmt.Sprintf("Cluster with name '%s' of type '%s'", cName, cType)} diff --git a/pkg/config/types.go b/pkg/config/types.go index 69d87b8ec..64d5a43d4 100644 --- a/pkg/config/types.go +++ b/pkg/config/types.go @@ -27,8 +27,8 @@ import ( // Top level config objects and all values required for proper functioning are not "omitempty". // Any truly optional piece of config is allowed to be omitted. -// Config holds the information required by airshipct commands -// It is somewhat a superset of what akubeconfig looks like, we allow for this overlaps by providing +// Config holds the information required by airshipctl commands +// It is somewhat a superset of what a kubeconfig looks like, we allow for this overlaps by providing // a mechanism to consume or produce a kubeconfig into / from the airship config. type Config struct { // +optional @@ -71,7 +71,7 @@ type Config struct { kubeConfig *kubeconfig.Config } -// Encapsultaes the Cluster Type as an enumeration +// Encapsulates the Cluster Type as an enumeration type ClusterPurpose struct { // Cluster map of referenceable names to cluster configs ClusterTypes map[string]*Cluster `json:"cluster-type"` @@ -79,13 +79,13 @@ type ClusterPurpose struct { // Cluster contains information about how to communicate with a kubernetes cluster type Cluster struct { - // Complex cluster name defined by the using __) NameInKubeconf string `json:"cluster-kubeconf"` // Kubeconfig Cluster Object kCluster *kubeconfig.Cluster - // Boostrap configuration this clusters ephemral hosts will rely on + // Bootstrap configuration this clusters ephemeral hosts will rely on Bootstrap string `json:"bootstrap-info"` } @@ -122,7 +122,7 @@ type Manifest struct { // Repositories is the map of repository adddressable by a name Repositories map[string]*Repository `json:"repositories"` - // Local Targer path for working or home dirctory for all Manifest Cloned/Returned/Generated + // Local Target path for working or home directory for all Manifest Cloned/Returned/Generated TargetPath string `json:"target-path"` } @@ -130,7 +130,7 @@ type Manifest struct { // Information such as location, authentication info, // as well as details of what to get such as branch, tag, commit it, etc. type Repository struct { - // URL for Repositor, + // URL for Repository Url *url.URL `json:"url"` // Username is the username for authentication to the repository . diff --git a/pkg/container/container.go b/pkg/container/container.go index 95bf032b5..185d3b552 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -5,7 +5,7 @@ import ( "io" ) -// Container interface abstracion for continer. +// Container interface abstraction for container. // Particular implementation depends on container runtime environment (CRE). Interface // defines methods that must be implemented for CRE (e.g. docker, containerd or CRI-O) type Container interface { @@ -17,7 +17,7 @@ type Container interface { } // NewContainer returns instance of Container interface implemented by particular driver -// Returned instance type (i.e. implementation) depends on driver sceified via function +// Returned instance type (i.e. implementation) depends on driver specified via function // arguments (e.g. "docker"). // Supported drivers: // * docker diff --git a/pkg/container/container_docker.go b/pkg/container/container_docker.go index 01cf7ff97..9730b59ec 100644 --- a/pkg/container/container_docker.go +++ b/pkg/container/container_docker.go @@ -58,7 +58,7 @@ type DockerClient interface { string, container.WaitCondition, ) (<-chan container.ContainerWaitOKBody, <-chan error) - // ContainerLogs returns the logs generated by a continer in an + // ContainerLogs returns the logs generated by a container in an // io.ReadCloser. ContainerLogs( context.Context, @@ -166,7 +166,7 @@ func (c *DockerContainer) getConfig( return cCfg, hCfg } -// getImageId return ID of continer image specified by URL. Method executes +// getImageId return ID of container image specified by URL. Method executes // ImageList function supplied with "reference" filter func (c *DockerContainer) getImageId(url string) (string, error) { kv := filters.KeyValuePair{ @@ -277,11 +277,11 @@ func (c *DockerContainer) RunCommand( // set to false explicitly func (c *DockerContainer) RunCommandOutput( cmd []string, - continerInput io.Reader, + containerInput io.Reader, volumeMounts []string, envVars []string, ) (io.ReadCloser, error) { - if err := c.RunCommand(cmd, continerInput, volumeMounts, envVars, false); err != nil { + if err := c.RunCommand(cmd, containerInput, volumeMounts, envVars, false); err != nil { return nil, err } diff --git a/pkg/container/container_docker_test.go b/pkg/container/container_docker_test.go index 34d0d62e0..34f48e302 100644 --- a/pkg/container/container_docker_test.go +++ b/pkg/container/container_docker_test.go @@ -242,13 +242,13 @@ func TestGetId(t *testing.T) { cnt := getDockerContainerMock(mockDockerClient{}) err := cnt.RunCommand([]string{"testCmd"}, nil, nil, []string{}, false) require.NoError(t, err) - actialId := cnt.GetId() + actualId := cnt.GetId() - assert.Equal(t, "testID", actialId) + assert.Equal(t, "testID", actualId) } func TestRunCommand(t *testing.T) { - imageListeError := fmt.Errorf("Image List Error") + imageListError := fmt.Errorf("Image List Error") attachError := fmt.Errorf("Attach error") containerStartError := fmt.Errorf("Container Start error") containerWaitError := fmt.Errorf("Container Wait Error") @@ -277,10 +277,10 @@ func TestRunCommand(t *testing.T) { debug: false, mockDockerClient: mockDockerClient{ imageList: func() ([]types.ImageSummary, error) { - return nil, imageListeError + return nil, imageListError }, }, - expectedErr: imageListeError, + expectedErr: imageListError, assertF: func(t *testing.T) {}, }, { @@ -467,17 +467,17 @@ func TestNewDockerContainer(t *testing.T) { assert.Equal(t, tt.expectedErr, actualErr) - var actualResStuct resultStruct + var actualResStruct resultStruct if actualRes == nil { - actualResStuct = resultStruct{} + actualResStruct = resultStruct{} } else { - actualResStuct = resultStruct{ + actualResStruct = resultStruct{ tag: actualRes.tag, imageUrl: actualRes.imageUrl, id: actualRes.id, } } - assert.Equal(t, tt.expectedResult, actualResStuct) + assert.Equal(t, tt.expectedResult, actualResStruct) } } diff --git a/pkg/container/errors.go b/pkg/container/errors.go index a7b74e268..241c64569 100644 --- a/pkg/container/errors.go +++ b/pkg/container/errors.go @@ -9,7 +9,7 @@ type ErrEmptyImageList struct { } func (e ErrEmptyImageList) Error() string { - return "Image List Error. No images filetered" + return "Image List Error. No images filtered" } // ErrRunContainerCommand returned if container command diff --git a/pkg/document/constants.go b/pkg/document/constants.go index 1d6af4b48..b5315f747 100644 --- a/pkg/document/constants.go +++ b/pkg/document/constants.go @@ -1,6 +1,6 @@ package document -// Document lables and annotations +// Document labels and annotations const ( ClusterType = "clustertype" // TODO (dukov) Replace with constants defined in config module once diff --git a/pkg/document/repo/repo.go b/pkg/document/repo/repo.go index 13b5c77b8..e074edbdf 100644 --- a/pkg/document/repo/repo.go +++ b/pkg/document/repo/repo.go @@ -27,7 +27,7 @@ const ( var ( ErrNoOpenRepo = errors.New("No open repository is stored") - ErrRemoteRefNotImplemented = errors.New("RemoteRef is not yet impletemented") + ErrRemoteRefNotImplemented = errors.New("RemoteRef is not yet implemented") ErrCantParseUrl = errors.New("Couldn't get target directory from URL") ) diff --git a/pkg/environment/settings.go b/pkg/environment/settings.go index eafcd00ab..e2f05be6c 100644 --- a/pkg/environment/settings.go +++ b/pkg/environment/settings.go @@ -75,9 +75,9 @@ func (a *AirshipCTLSettings) InitConfig() { } func (a *AirshipCTLSettings) setAirshipConfigPath() { - // (1) If the airshipConfigPath was received as an argument its aleady set + // (1) If the airshipConfigPath was received as an argument its already set if a.airshipConfigPath == "" { - // (2) If not , we can check if we got the Path via ENVIRONMNT variable, + // (2) If not , we can check if we got the Path via ENVIRONMENT variable, // set the appropriate fields a.setAirshipConfigPathFromEnv() } @@ -101,7 +101,7 @@ func (a *AirshipCTLSettings) setKubePathOptions() *clientcmd.PathOptions { kubePathOptions := clientcmd.NewDefaultPathOptions() // No need to check the Environment , since we are relying on the kubeconfig defaults // If we did not get an explicit kubeconfig definition on airshipctl - // as far as airshipctkl is concerned will use the default expectations for the kubeconfig + // as far as airshipctl is concerned will use the default expectations for the kubeconfig // file location . This avoids messing up someones kubeconfig if they didnt explicitly want // airshipctl to use it. kcp, home := a.replaceHomePlaceholder(a.kubeConfigPath) diff --git a/pkg/errors/common.go b/pkg/errors/common.go index b2f64ab09..d6af70ca8 100644 --- a/pkg/errors/common.go +++ b/pkg/errors/common.go @@ -7,7 +7,7 @@ type AirshipError struct { Message string } -// Error function implments the golang +// Error function implements the golang // error interface func (ae *AirshipError) Error() string { return ae.Message diff --git a/pkg/secret/rngsource.go b/pkg/secret/rngsource.go index bcc9b4d3b..62cfeaaaa 100644 --- a/pkg/secret/rngsource.go +++ b/pkg/secret/rngsource.go @@ -14,7 +14,7 @@ type Source struct{} var _ rand.Source = &Source{} // Uint64 returns a secure random uint64 in the range [0, 1<<64]. It will fail -// if an error is returned from the system's secure random numer generator +// if an error is returned from the system's secure random number generator func (s *Source) Uint64() uint64 { var value uint64 err := binary.Read(crypto.Reader, binary.BigEndian, &value) diff --git a/pkg/util/yaml/writer.go b/pkg/util/yaml/writer.go index 934bb1d4b..0f05d27e0 100644 --- a/pkg/util/yaml/writer.go +++ b/pkg/util/yaml/writer.go @@ -13,7 +13,7 @@ const ( DashYamlSeparator = "---\n" ) -// WriteOut dumps any yaml competible document to writer, adding yaml separator `---` +// WriteOut dumps any yaml compatible document to writer, adding yaml separator `---` // at the beginning of the document, and `...` at the end func WriteOut(dst io.Writer, src interface{}) error { yamlOut, err := yaml.Marshal(src)