You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't believe the documentation on --format is clear enough, nor do I think it can be made clear enough to accommodate for the complexity of Go's templates.
Steps to reproduce the issue
Steps to reproduce the issue
podman run -d -p 1234:1234 --name evanrox alpine:3 sleep 360
2, you get the stringification provided by Go's map.
3, you target a map and you get the stringification provided by Go's map.
4, you target a struct and you get either
the stringification provided by default Go's struct.
a custom stringification provided by the developers.
The workflow people will use when they're using podman inspect or jq is to iteratively refine the query until they get to the data they want. Go makes this very complex because if you get a map, you'll know how to further refine. But if you get a struct, you're stuck with {value1, value2} and it's not clear how to refine. This is what happened here, which I later found out was because of this.
The only solution I can think to this, is a very strong and bold suggestion that if using Go's --format and --filter, you should always use make your first step in trouble-shooting to use json, ie.,
If
podman inspect evanrox --format '{{ index .NetworkSettings.Ports "1234/tcp" 0 }}'
Doesn't make it clear to you what's wrong, you should immediately grab,
Putting it another way DO NOT TROUBLESHOOT WITH THE DEFAULT OR CUSTOM STRING IMPLEMENTATIONS USING FILTER, TROUBLESHOOT WITH json's STRING IMPLEMENTATION
Describe the results you expected
I would expect everything to use the stringification provided by map, and consistently. And not to change the implementation of stringify depending on the type of data that the template returned.
### Podman in a container
No
### Privileged Or Rootless
Rootless
### Upstream Latest Release
Yes
### Additional environment details
Additional environment details
### Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
The text was updated successfully, but these errors were encountered:
I would expect everything to use the stringification provided by map, and consistently. And not to change the implementation of stringify depending on the type of data that the template returned.
This is not a bug and works as expected. We have no control over the output from the go std lib and how it renders structs vs maps, etc...
Asking for better docs is fine (#17676) but we cannot change the output.
Issue Description
I don't believe the documentation on
--format
is clear enough, nor do I think it can be made clear enough to accommodate for the complexity of Go's templates.Steps to reproduce the issue
Steps to reproduce the issue
podman run -d -p 1234:1234 --name evanrox alpine:3 sleep 360
podman inspect evanrox
podman inspect evanrox --format '{{ .NetworkSettings.Ports }}'
podman inspect evanrox --format '{{index .NetworkSettings.Ports "1234/tcp" 0 }}'
Describe the results you received
Using the above steps, in
The workflow people will use when they're using
podman inspect
orjq
is to iteratively refine the query until they get to the data they want. Go makes this very complex because if you get a map, you'll know how to further refine. But if you get a struct, you're stuck with{value1, value2}
and it's not clear how to refine. This is what happened here, which I later found out was because of this.The only solution I can think to this, is a very strong and bold suggestion that if using Go's
--format
and--filter
, you should always use make your first step in trouble-shooting to usejson
, ie.,If
Doesn't make it clear to you what's wrong, you should immediately grab,
Putting it another way DO NOT TROUBLESHOOT WITH THE DEFAULT OR CUSTOM STRING IMPLEMENTATIONS USING FILTER, TROUBLESHOOT WITH
json
's STRING IMPLEMENTATIONDescribe the results you expected
I would expect everything to use the stringification provided by map, and consistently. And not to change the implementation of stringify depending on the type of data that the template returned.
podman info output
The text was updated successfully, but these errors were encountered: