set !remote build tags where needed

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 <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-08-15 13:15:59 +02:00
parent c17daf2b09
commit 942f789a88
158 changed files with 305 additions and 56 deletions

View File

@ -1,3 +1,5 @@
//go:build !remote
package main
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package main
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package main
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package main
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package main
import (

View File

@ -1,5 +1,4 @@
//go:build linux && !remote
// +build linux,!remote
package main

View File

@ -1,16 +0,0 @@
//go:build !linux || remote
// +build !linux remote
package main
import "github.com/containers/podman/v5/pkg/domain/entities"
const engineMode = entities.TunnelMode
func storeBefore() error {
return nil
}
func storeAfter() error {
return nil
}

View File

@ -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"
)
@ -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 {

View File

@ -1,3 +1,5 @@
//go:build !remote
package entities
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package entities
type CreateStorageLayerOptions struct {

View File

@ -1,3 +1,5 @@
//go:build !remote
package abi
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package abi
import "github.com/containers/podman/v5/internal/domain/entities"

View File

@ -1,25 +0,0 @@
//go:build remote
package infra
import (
"context"
"fmt"
ientities "github.com/containers/podman/v5/internal/domain/entities"
"github.com/containers/podman/v5/internal/domain/infra/tunnel"
"github.com/containers/podman/v5/pkg/bindings"
"github.com/containers/podman/v5/pkg/domain/entities"
)
// NewTestingEngine factory provides a libpod runtime for testing-specific operations
func NewTestingEngine(facts *entities.PodmanConfig) (ientities.TestingEngine, error) {
switch facts.EngineMode {
case entities.ABIMode:
return nil, fmt.Errorf("direct image runtime not supported")
case entities.TunnelMode:
ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.Identity, facts.MachineMode)
return &tunnel.TestingEngine{ClientCtx: ctx}, err
}
return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}

View File

@ -1,3 +1,5 @@
//go:build !remote
package tunnel
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package tunnel
import "github.com/containers/podman/v5/internal/domain/entities"

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (
@ -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 {

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package compat
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package handlers
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (
@ -499,7 +501,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)
ctr, err := runtime.LookupContainer(query.Container)
if err != nil {
utils.Error(w, http.StatusNotFound, err)

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package libpod
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
// Package swagger defines the payloads used by the Podman API
//
// - errors.go: declares the errors used in the API. By embedding errors.ErrorModel, more meaningful

View File

@ -1,3 +1,5 @@
//go:build !remote
//nolint:unused // these types are used to wire generated swagger to API code
package swagger

View File

@ -1,3 +1,5 @@
//go:build !remote
//nolint:unused // these types are used to wire generated swagger to API code
package swagger

View File

@ -1,3 +1,5 @@
//go:build !remote
//nolint:unused // these types are used to wire generated swagger to API code
package swagger

View File

@ -1,3 +1,5 @@
//go:build !remote
package apiutil
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package apiutil
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package utils
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package utils
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package utils
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package utils
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package utils
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
// Package server supports a RESTful API for the Libpod library
//
// This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package idle
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

View File

@ -1,3 +1,5 @@
//go:build !remote
package server
import (

Some files were not shown because too many files have changed in this diff Show More