Commit Graph

10 Commits

Author SHA1 Message Date
Paul Holzinger bb59d4611e use std maps package where possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-14 11:50:50 +01: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
Nalin Dahyabhai 0f7852ef9b pkg/manifests.List: add SetSubject()/Subject()
Add methods for reading and writing the index-level "subject" field.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-02-05 09:36:48 -05:00
Oleksandr Redko 63869c6bf3 chore: replace 'interface{}' with 'any' for consistency
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-08 21:26:34 +02:00
Oleksandr Redko 0e202b45a1 Refactor map init with short declaration syntax
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-06 19:28:43 +02:00
Oleksandr Redko 3cc2a76ae9 Fix typos across repo; extend codespell config
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-03 23:38:47 +02:00
Valentin Rothberg 29b42f3f4f attributedstring: add NewSlice func
Convenience function for callers.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-10-26 09:17:22 +02:00
Valentin Rothberg 33dfbc521b attributedstring.Slice: add Set() method
Needed in Buildah (and potentially Podman later on) where some options
must be overridden.  Ultimately this should be avoided whenever possible
but this is not my goal at the present.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-10-26 09:17:22 +02:00
Valentin Rothberg b103cb9e93 containers.conf: appendable string arrays, Part 1
Commit 395ba05c44 implemented a POC to allow for changing the behavior
when loading multiple container.conf files in sequence.  By default, the
TOML encoder will override existing data/fields with the one specified
in the loaded file.  The POC has demonstrated how this behavior can be
changed to append string slices instead of overriding/replacing them
entirely.

This change is the first step of integrating these appendable string
arrays into containers.conf and starts with enabling the `Env`,
`Mounts`, and `Volumes` fields in the `[Containers]` table.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-10-24 11:47:46 +02:00
Valentin Rothberg 395ba05c44 POC: appendable string arrays in containers.conf
As discussed in https://github.com/containers/podman/issues/20000, we
need an opt-in mechanism to _append_ string arrays during loading
sequence of containers.conf files.

At the moment, existing fields/data will be overriden with each loaded
config that sets the specified field/option.  The TOML (toml.io) config
format does not allow for attributing fields and structs are implicitly
represented as "tables".  I wanted to extend a string array with a
simple boolean field, for instance:
```TOML
env=["FOO=bar"]
env.append=true
```

TOML doesn't suppor tthe upper idea as it's not a properly formatted
table.  So I looked for alternatives and found that TOML supports
so-called "mixed-type arrays".  As the same suggests, such arrays allow
for including more than one type and that seemed like a reasonable
candidate as it allows for _extending_ the existing syntax without
introducing new fields or even yet-another way of loading conf files.

The new format can be seen in the tests.  Please note that this is just
a _tested_ POC.  Integrating the POC in containers.conf may turn into a
bigger journey as Podman is directly (ab)using many of the fields.
Since they have to be changed to the new type (see POC), Podman will not
compile without changes.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-10-05 13:32:26 +02:00