Skip to content

Commit

Permalink
set !remote build tags where needed
Browse files Browse the repository at this point in the history
The new golangci-lint version 1.60.1 has problems with typecheck when
linting remote files. We have certain pakcages that should never be
inlcuded in remote but the typecheck tries to compile all of them but
this never works and it seems to ignore the exclude files we gave it.

To fix this the proper way is to mark all packages we only use locally
with !remote tags. This is a bit ugly but more correct. I also moved the
DecodeChanges() code around as it is called from the client so the
handles package which should only be remote doesn't really fit anyway.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Aug 19, 2024
1 parent c17daf2 commit 942f789
Show file tree
Hide file tree
Showing 158 changed files with 305 additions and 56 deletions.
2 changes: 2 additions & 0 deletions cmd/podman-testing/create.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/podman-testing/data.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/podman-testing/layer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/podman-testing/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/podman-testing/remove.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package main

import (
Expand Down
1 change: 0 additions & 1 deletion cmd/podman-testing/store_supported.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build linux && !remote
// +build linux,!remote

package main

Expand Down
16 changes: 0 additions & 16 deletions cmd/podman-testing/store_unsupported.go

This file was deleted.

4 changes: 0 additions & 4 deletions cmd/podman/containers/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v5/cmd/podman/common"
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/pkg/api/handlers"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -105,9 +104,6 @@ func commit(cmd *cobra.Command, args []string) error {
if !commitOptions.Quiet {
commitOptions.Writer = os.Stderr
}
if len(commitOptions.Changes) > 0 {
commitOptions.Changes = handlers.DecodeChanges(commitOptions.Changes)
}
if len(configFile) > 0 {
cfg, err := os.ReadFile(configFile)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/entities/engine_testing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package entities

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/entities/testing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package entities

type CreateStorageLayerOptions struct {
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/infra/abi/testing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package abi

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/infra/abi/testing_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package abi

import "github.com/containers/podman/v5/internal/domain/entities"
Expand Down
25 changes: 0 additions & 25 deletions internal/domain/infra/runtime_tunnel.go

This file was deleted.

2 changes: 2 additions & 0 deletions internal/domain/infra/tunnel/testing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package tunnel

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/infra/tunnel/testing_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package tunnel

import "github.com/containers/podman/v5/internal/domain/entities"
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/auth.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/changes.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_archive.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_attach.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_create.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_export.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_logs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_pause.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_prune.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_restart.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_start.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_stats_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_stats_linux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_stop.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_top.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/containers_unpause.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/events.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/exec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
4 changes: 3 additions & 1 deletion pkg/api/handlers/compat/images.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down Expand Up @@ -137,7 +139,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
options.Author = query.Author
options.Pause = query.Pause
options.Squash = query.Squash
options.Changes = handlers.DecodeChanges(query.Changes)
options.Changes = util.DecodeChanges(query.Changes)
if r.Body != nil {
defer r.Body.Close()
if options.CommitOptions.OverrideConfig, err = abi.DecodeOverrideConfig(r.Body); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_build.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_history.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_prune.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_push.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_remove.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_save.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_search.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/images_tag.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/info.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/networks.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/ping.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/resize.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/secrets.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/system.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/compat/volumes.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package compat

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/decoder.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package handlers

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/libpod/containers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package libpod

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/libpod/containers_create.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package libpod

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/libpod/containers_stats.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package libpod

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/handlers/libpod/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !remote

package libpod

import (
Expand Down
Loading

0 comments on commit 942f789

Please sign in to comment.