Commit Graph

9 Commits

Author SHA1 Message Date
Paul Holzinger 805e7ae406 update golangci-lint to 1.60.3
Contains fixes for new linters, removed depracted and removed linters
from the config.

Most notably because we use go 1.22 now we can get rid of the copy for
loop vars[1]. Also as of the go 1..2 we can use the new int range syntax
in for loops the new intrange linter checks that.

[1] https://go.dev/blog/loopvar-preview

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-09-03 15:57:02 +02:00
Paul Holzinger 7e485a635f Replace golang.org/x/exp/slices with slices from std
Use "slices" from the standard library, this package was added in go
1.21 so we can use it now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-22 14:12:47 +02:00
Oleksandr Redko 4dbd58b735 Refactor: replace raw loops with funcs from slices and maps
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-05 00:11:15 +02:00
Paul Holzinger 4f12d22515 libnetwork: correctly assign free names
If no name is given we have to set a free one, however the logic was
broken since the beginning due some copy paste. This function as the
name suggests must return all network names so we know to not reuse an
existing one.

I just found this by accident no user ever reported this in almost two
years. This likely means no one uses the automatic names and everybody
set's their own name on the cli instead.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-13 14:00:59 +02:00
T K Chandra Hasan a34e72b144 Closes #15830 Support docker-specific network create options via CLI
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
2023-02-10 21:51:48 +05:30
Kir Kolyshkin b951b72412 Gofumpt the code
gofumpt is a stricter version of gofmt, basically making the code more
readable, and fixing the gocritic's octalLiterar warnings like this one:

	pkg/util/util_supported.go:26:17: octalLiteral: use new octal literal style, 0o722 (gocritic)
		return (perm & 0722) == 0700
			       ^

Generated by gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-09 16:50:11 -07:00
Paul Holzinger 60766b5e5e libnetwork: create pick subnets from subnet pool
When we create a bridge network and no subnet is given we will a free
one automatically. The current logic just took the first free /24
network after 10.89.0.0. Now we will instead use the default subnet pool
from containers.conf. The default value is still the same but users can
change it if they want. This also fixes a problem where podman network
create could pick a public ipv4 network when all 10.0.0.0/8 networks
were already used. Now it will error if no free subnet is found in the
subnet pools.

Fixes #930

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-15 15:30:42 +01:00
ye.sijun f49c05b158 fix typo
Signed-off-by: ye.sijun <junnplus@gmail.com>
2022-01-03 20:15:46 +08:00
Paul Holzinger 002673d22f add libnetwork package
Copy the libpod/network packages from podman to here so we can use the
same code in buildah as well.

This is mostly a one to one copy only the import paths have been changed
and some errors were added.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-16 19:07:38 +01:00