Skip to content

Commit

Permalink
fix linters
Browse files Browse the repository at this point in the history
Signed-off-by: Suleiman Dibirov <[email protected]>
  • Loading branch information
idsulik committed Feb 17, 2025
1 parent 73476ab commit 7c3c8d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion cmd/compose/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ func runHash(ctx context.Context, dockerCli command.Cli, opts configOptions) err
}

hash, err := compose.ServiceHash(s)

if err != nil {
return err
}
Expand Down
10 changes: 4 additions & 6 deletions pkg/compose/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func ServiceConfigsHash(project *types.Project, serviceConfig types.ServiceConfi
for _, config := range serviceConfig.Configs {
file := project.Configs[config.Source]
b, err := createTarForConfig(project, types.FileReferenceConfig(config), types.FileObjectConfig(file))

if err != nil {
return nil, err
}

Check warning on line 57 in pkg/compose/hash.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/hash.go#L56-L57

Added lines #L56 - L57 were not covered by tests
Expand All @@ -69,7 +68,6 @@ func ServiceSecretsHash(project *types.Project, serviceConfig types.ServiceConfi
for _, secret := range serviceConfig.Secrets {
file := project.Secrets[secret.Source]
b, err := createTarForConfig(project, types.FileReferenceConfig(secret), types.FileObjectConfig(file))

if err != nil {
return nil, err
}

Check warning on line 73 in pkg/compose/hash.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/hash.go#L72-L73

Added lines #L72 - L73 were not covered by tests
Expand Down Expand Up @@ -114,21 +112,21 @@ func createTarForConfig(

// NetworkHash computes the configuration hash for a network.
func NetworkHash(o *types.NetworkConfig) (string, error) {
bytes, err := json.Marshal(o)
data, err := json.Marshal(o)
if err != nil {
return "", err
}
return digest.SHA256.FromBytes(bytes).Encoded(), nil
return digest.SHA256.FromBytes(data).Encoded(), nil
}

// VolumeHash computes the configuration hash for a volume.
func VolumeHash(o types.VolumeConfig) (string, error) {
if o.Driver == "" { // (TODO: jhrotko) This probably should be fixed in compose-go
o.Driver = "local"
}
bytes, err := json.Marshal(o)
data, err := json.Marshal(o)
if err != nil {
return "", err
}
return digest.SHA256.FromBytes(bytes).Encoded(), nil
return digest.SHA256.FromBytes(data).Encoded(), nil
}
1 change: 0 additions & 1 deletion pkg/utils/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ func CreateTarByPath(path string, modTime time.Time) (*bytes.Buffer, error) {

return nil
})

if err != nil {
return nil, err
}

Check warning on line 128 in pkg/utils/tar.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/tar.go#L127-L128

Added lines #L127 - L128 were not covered by tests
Expand Down

0 comments on commit 7c3c8d2

Please sign in to comment.