summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-02-11 14:15:26 +0100
committerMatthew Heon <mheon@redhat.com>2021-02-18 11:09:40 -0500
commit3bddeebf930efb872b99966df5553e0baf81834a (patch)
treeec2f40a9dd4d79f4fab75d35f5094121c9c5b7a0 /pkg
parentc50d969a0e79161c9d5d6f7933009253b067233e (diff)
downloadpodman-3bddeebf930efb872b99966df5553e0baf81834a.tar.gz
podman-3bddeebf930efb872b99966df5553e0baf81834a.tar.bz2
podman-3bddeebf930efb872b99966df5553e0baf81834a.zip
Enable stylecheck linter
Use the stylecheck linter and fix the reported problems. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <paul.holzinger@web.de> <MH: Fix cherry-pick conflict> Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/networks.go4
-rw-r--r--pkg/bindings/containers/containers.go4
-rw-r--r--pkg/bindings/errors.go6
-rw-r--r--pkg/bindings/network/network.go8
-rw-r--r--pkg/domain/entities/network.go1
-rw-r--r--pkg/rootless/rootless.go16
-rw-r--r--pkg/util/utils.go4
7 files changed, 22 insertions, 21 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index f0b922885..95cb06189 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -277,10 +277,10 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) {
return
}
body := struct {
- Id string
+ ID string `json:"Id"`
Warning []string
}{
- Id: net.ID,
+ ID: net.ID,
}
utils.WriteResponse(w, http.StatusCreated, body)
}
diff --git a/pkg/bindings/containers/containers.go b/pkg/bindings/containers/containers.go
index 8e644b712..0a180c73d 100644
--- a/pkg/bindings/containers/containers.go
+++ b/pkg/bindings/containers/containers.go
@@ -270,8 +270,8 @@ func Top(ctx context.Context, nameOrID string, options *TopOptions) ([]string, e
}
params := url.Values{}
if options.Changed("Descriptors") {
- ps_args := strings.Join(options.GetDescriptors(), ",")
- params.Add("ps_args", ps_args)
+ psArgs := strings.Join(options.GetDescriptors(), ",")
+ params.Add("ps_args", psArgs)
}
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/top", params, nil, nameOrID)
if err != nil {
diff --git a/pkg/bindings/errors.go b/pkg/bindings/errors.go
index e75ce898d..51ea487be 100644
--- a/pkg/bindings/errors.go
+++ b/pkg/bindings/errors.go
@@ -20,12 +20,12 @@ func handleError(data []byte) error {
return e
}
-func (a APIResponse) Process(unmarshalInto interface{}) error {
- data, err := ioutil.ReadAll(a.Response.Body)
+func (h APIResponse) Process(unmarshalInto interface{}) error {
+ data, err := ioutil.ReadAll(h.Response.Body)
if err != nil {
return errors.Wrap(err, "unable to process API response")
}
- if a.IsSuccess() || a.IsRedirection() {
+ if h.IsSuccess() || h.IsRedirection() {
if unmarshalInto != nil {
return json.Unmarshal(data, unmarshalInto)
}
diff --git a/pkg/bindings/network/network.go b/pkg/bindings/network/network.go
index 7cd251b0e..d747f9bd7 100644
--- a/pkg/bindings/network/network.go
+++ b/pkg/bindings/network/network.go
@@ -102,7 +102,7 @@ func List(ctx context.Context, options *ListOptions) ([]*entities.NetworkListRep
}
// Disconnect removes a container from a given network
-func Disconnect(ctx context.Context, networkName string, ContainerNameOrId string, options *DisconnectOptions) error {
+func Disconnect(ctx context.Context, networkName string, ContainerNameOrID string, options *DisconnectOptions) error {
if options == nil {
options = new(DisconnectOptions)
}
@@ -117,7 +117,7 @@ func Disconnect(ctx context.Context, networkName string, ContainerNameOrId strin
Container string
Force bool
}{
- Container: ContainerNameOrId,
+ Container: ContainerNameOrID,
}
if force := options.GetForce(); options.Changed("Force") {
disconnect.Force = force
@@ -136,7 +136,7 @@ func Disconnect(ctx context.Context, networkName string, ContainerNameOrId strin
}
// Connect adds a container to a network
-func Connect(ctx context.Context, networkName string, ContainerNameOrId string, options *ConnectOptions) error {
+func Connect(ctx context.Context, networkName string, ContainerNameOrID string, options *ConnectOptions) error {
if options == nil {
options = new(ConnectOptions)
}
@@ -151,7 +151,7 @@ func Connect(ctx context.Context, networkName string, ContainerNameOrId string,
Container string
Aliases []string
}{
- Container: ContainerNameOrId,
+ Container: ContainerNameOrID,
}
if aliases := options.GetAliases(); options.Changed("Aliases") {
connect.Aliases = aliases
diff --git a/pkg/domain/entities/network.go b/pkg/domain/entities/network.go
index b76bfcac7..b41a9997e 100644
--- a/pkg/domain/entities/network.go
+++ b/pkg/domain/entities/network.go
@@ -31,6 +31,7 @@ type NetworkReloadOptions struct {
// NetworkReloadReport describes the results of reloading a container network.
type NetworkReloadReport struct {
+ // nolint:stylecheck
Id string
Err error
}
diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go
index df35c0d6b..b5538efc3 100644
--- a/pkg/rootless/rootless.go
+++ b/pkg/rootless/rootless.go
@@ -61,9 +61,9 @@ var (
gidMapOnce sync.Once
)
-// GetAvailableUidMap returns the UID mappings in the
+// GetAvailableUIDMap returns the UID mappings in the
// current user namespace.
-func GetAvailableUidMap() ([]user.IDMap, error) {
+func GetAvailableUIDMap() ([]user.IDMap, error) {
uidMapOnce.Do(func() {
var err error
uidMap, err = user.ParseIDMapFile("/proc/self/uid_map")
@@ -75,9 +75,9 @@ func GetAvailableUidMap() ([]user.IDMap, error) {
return uidMap, uidMapError
}
-// GetAvailableGidMap returns the GID mappings in the
+// GetAvailableGIDMap returns the GID mappings in the
// current user namespace.
-func GetAvailableGidMap() ([]user.IDMap, error) {
+func GetAvailableGIDMap() ([]user.IDMap, error) {
gidMapOnce.Do(func() {
var err error
gidMap, err = user.ParseIDMapFile("/proc/self/gid_map")
@@ -92,11 +92,11 @@ func GetAvailableGidMap() ([]user.IDMap, error) {
// GetAvailableIDMaps returns the UID and GID mappings in the
// current user namespace.
func GetAvailableIDMaps() ([]user.IDMap, []user.IDMap, error) {
- u, err := GetAvailableUidMap()
+ u, err := GetAvailableUIDMap()
if err != nil {
return nil, nil, err
}
- g, err := GetAvailableGidMap()
+ g, err := GetAvailableGIDMap()
if err != nil {
return nil, nil, err
}
@@ -114,7 +114,7 @@ func countAvailableIDs(mappings []user.IDMap) int64 {
// GetAvailableUids returns how many UIDs are available in the
// current user namespace.
func GetAvailableUids() (int64, error) {
- uids, err := GetAvailableUidMap()
+ uids, err := GetAvailableUIDMap()
if err != nil {
return -1, err
}
@@ -125,7 +125,7 @@ func GetAvailableUids() (int64, error) {
// GetAvailableGids returns how many GIDs are available in the
// current user namespace.
func GetAvailableGids() (int64, error) {
- gids, err := GetAvailableGidMap()
+ gids, err := GetAvailableGIDMap()
if err != nil {
return -1, err
}
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index e0f631eb4..901a482f6 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -530,9 +530,9 @@ func ParseInputTime(inputTime string) (time.Time, error) {
}
}
- unix_timestamp, err := strconv.ParseInt(inputTime, 10, 64)
+ unixTimestamp, err := strconv.ParseInt(inputTime, 10, 64)
if err == nil {
- return time.Unix(unix_timestamp, 0), nil
+ return time.Unix(unixTimestamp, 0), nil
}
// input might be a duration