all: fix golangci-lint issues (#3064)
This commit is contained in:
parent
bfb6fd80df
commit
ce580f8245
131 changed files with 3131 additions and 1560 deletions
|
|
@ -18,8 +18,9 @@ func GetFirstOrCreateNetwork(pool *dockertest.Pool, name string) (*dockertest.Ne
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("looking up network names: %w", err)
|
||||
}
|
||||
|
||||
if len(networks) == 0 {
|
||||
if _, err := pool.CreateNetwork(name); err == nil {
|
||||
if _, err := pool.CreateNetwork(name); err == nil { //nolint:noinlineerr // intentional inline check
|
||||
// Create does not give us an updated version of the resource, so we need to
|
||||
// get it again.
|
||||
networks, err := pool.NetworksByName(name)
|
||||
|
|
@ -90,6 +91,7 @@ func RandomFreeHostPort() (int, error) {
|
|||
// CleanUnreferencedNetworks removes networks that are not referenced by any containers.
|
||||
func CleanUnreferencedNetworks(pool *dockertest.Pool) error {
|
||||
filter := "name=hs-"
|
||||
|
||||
networks, err := pool.NetworksByName(filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting networks by filter %q: %w", filter, err)
|
||||
|
|
@ -122,6 +124,7 @@ func CleanImagesInCI(pool *dockertest.Pool) error {
|
|||
}
|
||||
|
||||
removedCount := 0
|
||||
|
||||
for _, image := range images {
|
||||
// Only remove dangling (untagged) images to avoid forcing rebuilds
|
||||
// Dangling images have no RepoTags or only have "<none>:<none>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue