mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

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>
65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
//go:build linux && !remote
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/containers/podman/v5/pkg/domain/entities"
|
|
"github.com/containers/storage"
|
|
"github.com/containers/storage/types"
|
|
)
|
|
|
|
var (
|
|
globalStore storage.Store
|
|
engineMode = entities.ABIMode
|
|
)
|
|
|
|
func init() {
|
|
if defaultStoreOptions, err := storage.DefaultStoreOptions(); err == nil {
|
|
globalStorageOptions = defaultStoreOptions
|
|
}
|
|
if storageConf, ok := os.LookupEnv("CONTAINERS_STORAGE_CONF"); ok {
|
|
options := globalStorageOptions
|
|
if types.ReloadConfigurationFileIfNeeded(storageConf, &options) == nil {
|
|
globalStorageOptions = options
|
|
}
|
|
}
|
|
fl := mainCmd.PersistentFlags()
|
|
fl.StringVar(&globalStorageOptions.GraphDriverName, "storage-driver", "", "storage driver used to manage images and containers")
|
|
fl.StringVar(&globalStorageOptions.GraphRoot, "root", "", "where images and containers will be stored")
|
|
fl.StringVar(&globalStorageOptions.RunRoot, "runroot", "", "where volatile state information will be stored")
|
|
fl.StringArrayVar(&globalStorageOptions.GraphDriverOptions, "storage-opt", nil, "storage driver options")
|
|
fl.StringVar(&globalStorageOptions.ImageStore, "imagestore", "", "where to store just some parts of images")
|
|
fl.BoolVar(&globalStorageOptions.TransientStore, "transient-store", false, "enable transient container storage")
|
|
}
|
|
|
|
func storeBefore() error {
|
|
defaultStoreOptions, err := storage.DefaultStoreOptions()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "selecting storage options: %v", err)
|
|
return nil
|
|
}
|
|
globalStorageOptions = defaultStoreOptions
|
|
store, err := storage.GetStore(globalStorageOptions)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
globalStore = store
|
|
if podmanConfig.URI != "" {
|
|
engineMode = entities.TunnelMode
|
|
} else {
|
|
engineMode = entities.ABIMode
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func storeAfter() error {
|
|
if globalStore != nil {
|
|
_, err := globalStore.Shutdown(false)
|
|
return err
|
|
}
|
|
return nil
|
|
}
|