From 37caaf1ee56c67630ec12c752530b53bdc17f50f Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Fri, 27 Oct 2023 12:50:41 +0200 Subject: [PATCH 1/2] support symlinks for archive creation (#559) * support symlinks for archive creation * fix transporting signatures in overwrite mode --- .github/workflows/lint_and_test.yaml | 2 +- .golangci.yaml | 5 ++++- docs/pluginreference/plugin_accessmethod_compose.md | 2 +- docs/pluginreference/plugin_descriptor.md | 4 ++-- docs/pluginreference/plugin_valuemergehandler_execute.md | 4 ++-- docs/pluginreference/plugin_valueset.md | 2 +- docs/pluginreference/plugin_valueset_compose.md | 2 +- docs/reference/ocm_ocm-uploadhandlers.md | 2 +- docs/reference/ocm_transfer_commontransportarchive.md | 2 +- docs/reference/ocm_transfer_componentversions.md | 2 +- go.mod | 2 +- hack/Makefile | 2 +- hack/install-requirements.sh | 4 +++- pkg/cobrautils/flag/labelledstring.go | 8 ++++---- pkg/common/accessio/blobaccess/standard.go | 5 +---- pkg/common/accessio/resource/doc.go | 2 +- pkg/common/iotools/utils.go | 2 -- pkg/contexts/oci/repositories/ctf/testhelper/fill.go | 1 + pkg/contexts/oci/testhelper/manifests.go | 1 + .../blobhandler/handlers/generic/ocirepo/registration.go | 2 +- pkg/contexts/ocm/cpi/view_rsc.go | 2 -- pkg/contexts/ocm/interface.go | 2 +- pkg/contexts/ocm/plugin/internal/access.go | 8 ++++---- pkg/contexts/ocm/plugin/internal/upload.go | 2 +- .../ocm/plugin/ppi/cmds/accessmethod/compose/cmd.go | 2 +- .../ocm/plugin/ppi/cmds/mergehandler/execute/cmd.go | 4 ++-- .../ocm/plugin/ppi/cmds/topics/descriptor/topic.go | 4 ++-- pkg/contexts/ocm/plugin/ppi/cmds/valueset/cmd.go | 2 +- pkg/contexts/ocm/plugin/ppi/cmds/valueset/compose/cmd.go | 2 +- pkg/contexts/ocm/testhelper/resources.go | 1 + .../valuemergehandler/handlers/maplistmerge/handler.go | 8 +++++--- .../valuemergehandler/handlers/simplelistmerge/handler.go | 8 +++++--- .../valuemergehandler/handlers/simplemapmerge/handler.go | 8 +++++--- pkg/runtime/datatypes.go | 1 - pkg/signing/types.go | 2 +- pkg/testutils/utils.go | 2 +- 36 files changed, 60 insertions(+), 54 deletions(-) diff --git a/.github/workflows/lint_and_test.yaml b/.github/workflows/lint_and_test.yaml index 1a1cb513b7..1d6dc2dd97 100644 --- a/.github/workflows/lint_and_test.yaml +++ b/.github/workflows/lint_and_test.yaml @@ -66,7 +66,7 @@ jobs: go install golang.org/x/tools/cmd/goimports@latest - name: Setup lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 - name: Lint run: | PATH=$PATH:$(go env GOPATH)/bin make check diff --git a/.golangci.yaml b/.golangci.yaml index 2d81eaaf2e..4e410587c0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,5 +1,5 @@ run: - go: "1.19" + go: "1.20" timeout: 10m tests: false allow-parallel-runners: true @@ -73,6 +73,9 @@ linters: # Disabled with reason + - nakedret + - depguard + - mirror - dogsled - exhaustruct # Doesn't really make sense. - exhaustive # Doesn't really make sense. diff --git a/docs/pluginreference/plugin_accessmethod_compose.md b/docs/pluginreference/plugin_accessmethod_compose.md index 8810f39ea9..58bd57eff4 100644 --- a/docs/pluginreference/plugin_accessmethod_compose.md +++ b/docs/pluginreference/plugin_accessmethod_compose.md @@ -28,7 +28,7 @@ If possible, predefined standard options should be used. In such a case only the name field should be defined for an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided -by other plugins. Therefore, it is highly recommended to use use names prefixed +by other plugins. Therefore, it is highly recommended to use names prefixed by the plugin name. diff --git a/docs/pluginreference/plugin_descriptor.md b/docs/pluginreference/plugin_descriptor.md index 20b09edf03..2700827888 100644 --- a/docs/pluginreference/plugin_descriptor.md +++ b/docs/pluginreference/plugin_descriptor.md @@ -114,7 +114,7 @@ It uses the following fields: an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided by other plugins. Therefore - it is highly recommended to use use names prefixed by the plugin name. + it is highly recommended to use names prefixed by the plugin name. The following predefined option types can be used: @@ -240,7 +240,7 @@ The descriptor for an action has the following fields: element the action should work on. But it might be, that other credentials are required to fulfill its task. Therefore, the action can request a dedicated consumer type used to lookup the credentials. The consumer attributes are - derived from the the action specification and cannot be influenced by the + derived from the action specification and cannot be influenced by the plugin. ### Value Merge Handler Descriptor diff --git a/docs/pluginreference/plugin_valuemergehandler_execute.md b/docs/pluginreference/plugin_valuemergehandler_execute.md index f058d08e77..a2f95a7ac3 100644 --- a/docs/pluginreference/plugin_valuemergehandler_execute.md +++ b/docs/pluginreference/plugin_valuemergehandler_execute.md @@ -15,7 +15,7 @@ plugin valuemergehandler execute [] ### Description -This command executes a a value merge. The values are taken from *stdin* as JSON +This command executes a value merge. The values are taken from *stdin* as JSON string. It has the following fields: - **local** *any* @@ -24,7 +24,7 @@ string. It has the following fields: - **inbound** *any* - The value to merge into. THis value is based on the original inbound value. + The value to merge into. This value is based on the original inbound value. This action has to provide an execution result as JSON string on *stdout*. It has the following fields: diff --git a/docs/pluginreference/plugin_valueset.md b/docs/pluginreference/plugin_valueset.md index ebc05ff5b0..81c8c1dad7 100644 --- a/docs/pluginreference/plugin_valueset.md +++ b/docs/pluginreference/plugin_valueset.md @@ -14,7 +14,7 @@ plugin valueset [] ... ### Description -This command group provides all commands used to implement a a value set +This command group provides all commands used to implement a value set described by a value set descriptor ([plugin descriptor](plugin_descriptor.md). ### SEE ALSO diff --git a/docs/pluginreference/plugin_valueset_compose.md b/docs/pluginreference/plugin_valueset_compose.md index d915706b24..d7466f9d9f 100644 --- a/docs/pluginreference/plugin_valueset_compose.md +++ b/docs/pluginreference/plugin_valueset_compose.md @@ -28,7 +28,7 @@ If possible, predefined standard options should be used. In such a case only the name field should be defined for an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided -by other plugins. Therefore, it is highly recommended to use use names prefixed +by other plugins. Therefore, it is highly recommended to use names prefixed by the plugin name. diff --git a/docs/reference/ocm_ocm-uploadhandlers.md b/docs/reference/ocm_ocm-uploadhandlers.md index 0fca4eafc8..161043fd17 100644 --- a/docs/reference/ocm_ocm-uploadhandlers.md +++ b/docs/reference/ocm_ocm-uploadhandlers.md @@ -42,7 +42,7 @@ The following handler names are possible: - ocm/ociArtifacts: downloading OCI artifacts - The ociArtifacts downloader is able to to download OCI artifacts + The ociArtifacts downloader is able to download OCI artifacts as artifact archive according to the OCI distribution spec. The following artifact media types are supported: - application/vnd.oci.image.manifest.v1+tar diff --git a/docs/reference/ocm_transfer_commontransportarchive.md b/docs/reference/ocm_transfer_commontransportarchive.md index 4fb5b7da3d..e1aacb5386 100644 --- a/docs/reference/ocm_transfer_commontransportarchive.md +++ b/docs/reference/ocm_transfer_commontransportarchive.md @@ -111,7 +111,7 @@ The uploader name may be a path expression with the following possibilities: - ocm/ociArtifacts: downloading OCI artifacts - The ociArtifacts downloader is able to to download OCI artifacts + The ociArtifacts downloader is able to download OCI artifacts as artifact archive according to the OCI distribution spec. The following artifact media types are supported: - application/vnd.oci.image.manifest.v1+tar diff --git a/docs/reference/ocm_transfer_componentversions.md b/docs/reference/ocm_transfer_componentversions.md index f3091f9586..1b8a809b11 100644 --- a/docs/reference/ocm_transfer_componentversions.md +++ b/docs/reference/ocm_transfer_componentversions.md @@ -167,7 +167,7 @@ The uploader name may be a path expression with the following possibilities: - ocm/ociArtifacts: downloading OCI artifacts - The ociArtifacts downloader is able to to download OCI artifacts + The ociArtifacts downloader is able to download OCI artifacts as artifact archive according to the OCI distribution spec. The following artifact media types are supported: - application/vnd.oci.image.manifest.v1+tar diff --git a/go.mod b/go.mod index b3b3776852..25cd5661db 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/open-component-model/ocm -go 1.19 +go 1.20 replace github.com/spf13/cobra => github.com/open-component-model/cobra v0.0.0-20230329075350-b1fd876abfb9 diff --git a/hack/Makefile b/hack/Makefile index d5c5df1cd9..941fcb6b2e 100644 --- a/hack/Makefile +++ b/hack/Makefile @@ -33,7 +33,7 @@ ifeq ("v$(JQ)","v0.0") deps += $(detected_OS)_jq endif -GOLANGCILINT_VERSION := "v1.49.0" +GOLANGCILINT_VERSION := "v1.54.2" GOLANGCILINTV := $(shell (golangci-lint --version 2>/dev/null || echo 0.0.0) | sed 's/.*v\([0-9\.]*\) .*/\1/') ifneq ("v$(GOLANGCILINTV)",$(GOLANGCILINT_VERSION)) deps += golangci-lint diff --git a/hack/install-requirements.sh b/hack/install-requirements.sh index e49289b6e0..0c5a7b15e1 100755 --- a/hack/install-requirements.sh +++ b/hack/install-requirements.sh @@ -9,7 +9,9 @@ PROJECT_ROOT="${CURRENT_DIR}"/.. echo "> Install Go packages/binaries" -curl -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh" | sh -s -- -b $(go env GOPATH)/bin v1.49.0 +curl -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh" | sh -s -- -b $(go env GOPATH)/bin v1.54.2 + +GO111MODULE=off go get -u github.com/go-bindata/go-bindata/... go install github.com/go-bindata/go-bindata/v3/go-bindata@v3.1.3 go install golang.org/x/tools/cmd/goimports@latest diff --git a/pkg/cobrautils/flag/labelledstring.go b/pkg/cobrautils/flag/labelledstring.go index e7ddaec099..f90e072a1e 100644 --- a/pkg/cobrautils/flag/labelledstring.go +++ b/pkg/cobrautils/flag/labelledstring.go @@ -31,12 +31,12 @@ func (i *labelledStringValue) String() string { } func (i *labelledStringValue) Set(s string) error { - idx := strings.Index(s, "=") - if idx <= 0 { + name, value, found := strings.Cut(s, "=") + if !found { return fmt.Errorf("expected =") } - i.Name = s[:idx] - i.Value = s[idx+1:] + i.Name = name + i.Value = value return nil } diff --git a/pkg/common/accessio/blobaccess/standard.go b/pkg/common/accessio/blobaccess/standard.go index 87c0f2de94..35cbeb45f6 100644 --- a/pkg/common/accessio/blobaccess/standard.go +++ b/pkg/common/accessio/blobaccess/standard.go @@ -103,10 +103,7 @@ func ProviderForData(mime string, data []byte) BlobAccessProvider { }) } -type ( - _blobAccess = BlobAccess - _blobAccessBase = spi.BlobAccessBase -) +type _blobAccess = BlobAccess //////////////////////////////////////////////////////////////////////////////// diff --git a/pkg/common/accessio/resource/doc.go b/pkg/common/accessio/resource/doc.go index 1ff59c2bbd..e28e9a39a6 100644 --- a/pkg/common/accessio/resource/doc.go +++ b/pkg/common/accessio/resource/doc.go @@ -81,7 +81,7 @@ // It implements the minimal implementation interface and offers with // the method View a way to create additional views. It can just be // instantiated for the base usage. -// Using the creator NewResourceImplBase is is possible to support +// Using the creator NewResourceImplBase it is possible to support // - nested use-cases, where an implementations hold a reference // on a parent object // - additional closers are required. diff --git a/pkg/common/iotools/utils.go b/pkg/common/iotools/utils.go index ed44d9bf86..d38a8facba 100644 --- a/pkg/common/iotools/utils.go +++ b/pkg/common/iotools/utils.go @@ -10,8 +10,6 @@ import ( type NopCloser struct{} -type _nopCloser = NopCloser - func (NopCloser) Close() error { return nil } diff --git a/pkg/contexts/oci/repositories/ctf/testhelper/fill.go b/pkg/contexts/oci/repositories/ctf/testhelper/fill.go index bcdf46b66e..286b08dc17 100644 --- a/pkg/contexts/oci/repositories/ctf/testhelper/fill.go +++ b/pkg/contexts/oci/repositories/ctf/testhelper/fill.go @@ -18,6 +18,7 @@ import ( "github.com/open-component-model/ocm/pkg/testutils" ) +//nolint:gosec // digests of test manifests const ( TAG = "v1" DIGEST_MANIFEST = "3d05e105e350edf5be64fe356f4906dd3f9bf442a279e4142db9879bba8e677a" diff --git a/pkg/contexts/oci/testhelper/manifests.go b/pkg/contexts/oci/testhelper/manifests.go index 2819ca268a..6253e6d363 100644 --- a/pkg/contexts/oci/testhelper/manifests.go +++ b/pkg/contexts/oci/testhelper/manifests.go @@ -2,6 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 +//nolint:gosec // digests of test manifests package testhelper import ( diff --git a/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/registration.go b/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/registration.go index 202ddf82cb..b1b7e3c527 100644 --- a/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/registration.go +++ b/pkg/contexts/ocm/blobhandler/handlers/generic/ocirepo/registration.go @@ -66,7 +66,7 @@ func (r *RegistrationHandler) RegisterByName(handler string, ctx cpi.Context, co func (r *RegistrationHandler) GetHandlers(ctx cpi.Context) registrations.HandlerInfos { return registrations.NewLeafHandlerInfo("downloading OCI artifacts", ` -The ociArtifacts downloader is able to to download OCI artifacts +The ociArtifacts downloader is able to download OCI artifacts as artifact archive according to the OCI distribution spec. The following artifact media types are supported: `+listformat.FormatList("", artdesc.ArchiveBlobTypes()...)+` diff --git a/pkg/contexts/ocm/cpi/view_rsc.go b/pkg/contexts/ocm/cpi/view_rsc.go index bf22c15174..4147dc78e8 100644 --- a/pkg/contexts/ocm/cpi/view_rsc.go +++ b/pkg/contexts/ocm/cpi/view_rsc.go @@ -25,8 +25,6 @@ var _ AccessProvider = (*ComponentVersionBasedAccessProvider)(nil) // Deprecated: use ComponentVersionBasedAccessProvider. type BaseAccess = ComponentVersionBasedAccessProvider -type cvBaseAccess = ComponentVersionBasedAccessProvider - func NewBaseAccess(cv ComponentVersionAccess, acc compdesc.AccessSpec) *ComponentVersionBasedAccessProvider { return &ComponentVersionBasedAccessProvider{vers: cv, access: acc} } diff --git a/pkg/contexts/ocm/interface.go b/pkg/contexts/ocm/interface.go index 98f5bb340f..b1ee620b46 100644 --- a/pkg/contexts/ocm/interface.go +++ b/pkg/contexts/ocm/interface.go @@ -197,7 +197,7 @@ func BlobAccessForAccessMethod(m AccessMethodView) (blobaccess.AnnotatedBlobAcce // a multi-view version. The original method is closed when // the last view is closed. // After an access method is used as base object, it should not -// explicitly closed anymore, because the the views will stop +// explicitly closed anymore, because the views will stop // functioning. func AccessMethodAsView(acc ocm.AccessMethod, closer ...io.Closer) AccessMethodView { return cpi.AccessMethodAsView(acc, closer...) diff --git a/pkg/contexts/ocm/plugin/internal/access.go b/pkg/contexts/ocm/plugin/internal/access.go index 684f377dae..b53cbae0e7 100644 --- a/pkg/contexts/ocm/plugin/internal/access.go +++ b/pkg/contexts/ocm/plugin/internal/access.go @@ -9,8 +9,8 @@ import ( ) type AccessSpecInfo struct { - Short string - MediaType string - Hint string - ConsumerId credentials.ConsumerIdentity + Short string `json:"short"` + MediaType string `json:"mediaType"` + Hint string `json:"hint"` + ConsumerId credentials.ConsumerIdentity `json:"consumerId"` } diff --git a/pkg/contexts/ocm/plugin/internal/upload.go b/pkg/contexts/ocm/plugin/internal/upload.go index 31327a5016..780b5e94d8 100644 --- a/pkg/contexts/ocm/plugin/internal/upload.go +++ b/pkg/contexts/ocm/plugin/internal/upload.go @@ -9,5 +9,5 @@ import ( ) type UploadTargetSpecInfo struct { - ConsumerId credentials.ConsumerIdentity + ConsumerId credentials.ConsumerIdentity `json:"consumerId"` } diff --git a/pkg/contexts/ocm/plugin/ppi/cmds/accessmethod/compose/cmd.go b/pkg/contexts/ocm/plugin/ppi/cmds/accessmethod/compose/cmd.go index 9087612fa5..f5abf52258 100644 --- a/pkg/contexts/ocm/plugin/ppi/cmds/accessmethod/compose/cmd.go +++ b/pkg/contexts/ocm/plugin/ppi/cmds/accessmethod/compose/cmd.go @@ -38,7 +38,7 @@ If possible, predefined standard options should be used. In such a case only the name field should be defined for an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided -by other plugins. Therefore, it is highly recommended to use use names prefixed +by other plugins. Therefore, it is highly recommended to use names prefixed by the plugin name. ` + options.DefaultRegistry.Usage(), diff --git a/pkg/contexts/ocm/plugin/ppi/cmds/mergehandler/execute/cmd.go b/pkg/contexts/ocm/plugin/ppi/cmds/mergehandler/execute/cmd.go index 30e1c221d7..cbfc422ce5 100644 --- a/pkg/contexts/ocm/plugin/ppi/cmds/mergehandler/execute/cmd.go +++ b/pkg/contexts/ocm/plugin/ppi/cmds/mergehandler/execute/cmd.go @@ -30,7 +30,7 @@ func New(p ppi.Plugin) *cobra.Command { Use: Name + " ", Short: "execute a value merge", Long: ` -This command executes a a value merge. The values are taken from *stdin* as JSON +This command executes a value merge. The values are taken from *stdin* as JSON string. It has the following fields: - **local** *any* @@ -39,7 +39,7 @@ string. It has the following fields: - **inbound** *any* - The value to merge into. THis value is based on the original inbound value. + The value to merge into. This value is based on the original inbound value. This action has to provide an execution result as JSON string on *stdout*. It has the following fields: diff --git a/pkg/contexts/ocm/plugin/ppi/cmds/topics/descriptor/topic.go b/pkg/contexts/ocm/plugin/ppi/cmds/topics/descriptor/topic.go index 03c1f56384..23cd9be25b 100644 --- a/pkg/contexts/ocm/plugin/ppi/cmds/topics/descriptor/topic.go +++ b/pkg/contexts/ocm/plugin/ppi/cmds/topics/descriptor/topic.go @@ -158,7 +158,7 @@ It uses the following fields: an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided by other plugins. Therefore - it is highly recommended to use use names prefixed by the plugin name. + it is highly recommended to use names prefixed by the plugin name. ` + options.DefaultRegistry.Usage() + ` @@ -254,7 +254,7 @@ The descriptor for an action has the following fields: element the action should work on. But it might be, that other credentials are required to fulfill its task. Therefore, the action can request a dedicated consumer type used to lookup the credentials. The consumer attributes are - derived from the the action specification and cannot be influenced by the + derived from the action specification and cannot be influenced by the plugin. ### Value Merge Handler Descriptor diff --git a/pkg/contexts/ocm/plugin/ppi/cmds/valueset/cmd.go b/pkg/contexts/ocm/plugin/ppi/cmds/valueset/cmd.go index 447ba095df..133c52d471 100644 --- a/pkg/contexts/ocm/plugin/ppi/cmds/valueset/cmd.go +++ b/pkg/contexts/ocm/plugin/ppi/cmds/valueset/cmd.go @@ -18,7 +18,7 @@ func New(p ppi.Plugin) *cobra.Command { cmd := &cobra.Command{ Use: Name, Short: "valueset operations", - Long: `This command group provides all commands used to implement a a value set + Long: `This command group provides all commands used to implement a value set described by a value set descriptor (` + p.Name() + ` descriptor.`, } diff --git a/pkg/contexts/ocm/plugin/ppi/cmds/valueset/compose/cmd.go b/pkg/contexts/ocm/plugin/ppi/cmds/valueset/compose/cmd.go index a5f195673d..e61c3ccf96 100644 --- a/pkg/contexts/ocm/plugin/ppi/cmds/valueset/compose/cmd.go +++ b/pkg/contexts/ocm/plugin/ppi/cmds/valueset/compose/cmd.go @@ -39,7 +39,7 @@ If possible, predefined standard options should be used. In such a case only the name field should be defined for an option. If required, new options can be defined by additionally specifying a type and a description. New options should be used very carefully. The chosen names MUST not conflict with names provided -by other plugins. Therefore, it is highly recommended to use use names prefixed +by other plugins. Therefore, it is highly recommended to use names prefixed by the plugin name. ` + options.DefaultRegistry.Usage(), diff --git a/pkg/contexts/ocm/testhelper/resources.go b/pkg/contexts/ocm/testhelper/resources.go index 03d5b07319..b2b24fdb77 100644 --- a/pkg/contexts/ocm/testhelper/resources.go +++ b/pkg/contexts/ocm/testhelper/resources.go @@ -2,6 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 +//nolint:gosec // digests of test manifests package testhelper import ( diff --git a/pkg/contexts/ocm/valuemergehandler/handlers/maplistmerge/handler.go b/pkg/contexts/ocm/valuemergehandler/handlers/maplistmerge/handler.go index 2f7b176751..f97c0e4d74 100644 --- a/pkg/contexts/ocm/valuemergehandler/handlers/maplistmerge/handler.go +++ b/pkg/contexts/ocm/valuemergehandler/handlers/maplistmerge/handler.go @@ -19,9 +19,11 @@ func init() { hpi.Register(New()) } -// Value is the minimal structure of values usable with the merge algorithm. -type Value = []Entry -type Entry = map[string]interface{} +type ( + // Value is the minimal structure of values usable with the merge algorithm. + Value = []Entry + Entry = map[string]interface{} +) func New() hpi.Handler { return hpi.New(ALGORITHM, desc, merge) diff --git a/pkg/contexts/ocm/valuemergehandler/handlers/simplelistmerge/handler.go b/pkg/contexts/ocm/valuemergehandler/handlers/simplelistmerge/handler.go index 1f86a78865..82212be7b4 100644 --- a/pkg/contexts/ocm/valuemergehandler/handlers/simplelistmerge/handler.go +++ b/pkg/contexts/ocm/valuemergehandler/handlers/simplelistmerge/handler.go @@ -16,9 +16,11 @@ func init() { hpi.Register(New()) } -// Value is the minimal structure of values usable with the merge algorithm. -type Value = []Entry -type Entry = interface{} +type ( + // Value is the minimal structure of values usable with the merge algorithm. + Value = []Entry + Entry = interface{} +) func New() hpi.Handler { return hpi.New(ALGORITHM, desc, merge) diff --git a/pkg/contexts/ocm/valuemergehandler/handlers/simplemapmerge/handler.go b/pkg/contexts/ocm/valuemergehandler/handlers/simplemapmerge/handler.go index 198c2c5349..8664759c43 100644 --- a/pkg/contexts/ocm/valuemergehandler/handlers/simplemapmerge/handler.go +++ b/pkg/contexts/ocm/valuemergehandler/handlers/simplemapmerge/handler.go @@ -18,9 +18,11 @@ func init() { hpi.Register(New()) } -// Value is the minimal structure of values usable with the merge algorithm. -type Value = map[string]Entry -type Entry = interface{} +type ( + // Value is the minimal structure of values usable with the merge algorithm. + Value = map[string]Entry + Entry = interface{} +) func New() hpi.Handler { return hpi.New(ALGORITHM, desc, merge) diff --git a/pkg/runtime/datatypes.go b/pkg/runtime/datatypes.go index c7a4143c32..f1c0b6eb03 100644 --- a/pkg/runtime/datatypes.go +++ b/pkg/runtime/datatypes.go @@ -25,7 +25,6 @@ type ( TypeInfo interface { TypeGetter } - _TypeInfo = TypeInfo ) type ( diff --git a/pkg/signing/types.go b/pkg/signing/types.go index b8fd318536..aa9757d6a3 100644 --- a/pkg/signing/types.go +++ b/pkg/signing/types.go @@ -14,7 +14,7 @@ import ( "github.com/open-component-model/ocm/pkg/contexts/credentials" ) -type Signature struct { +type Signature struct { //nolint: musttag // only for string output Value string MediaType string Algorithm string diff --git a/pkg/testutils/utils.go b/pkg/testutils/utils.go index 5f0c36d936..24015fadf2 100644 --- a/pkg/testutils/utils.go +++ b/pkg/testutils/utils.go @@ -99,7 +99,7 @@ func MustBeSuccessfulWithOffset(offset int, err error) { } func MustFailWithMessage(err error, msg string) { - ExpectWithOffset(1, err).NotTo(BeNil()) + ExpectWithOffset(1, err).To(HaveOccurred()) ExpectWithOffset(1, err.Error()).To(Equal(msg)) } From 9bd8c81c802b9676e1a4766d0890b33d4eebfbc6 Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Mon, 2 Oct 2023 10:22:47 +0200 Subject: [PATCH 2/2] 1.21 + take versions from sources --- .github/workflows/lint_and_test.yaml | 3 ++- .golangci.yaml | 2 +- go.mod | 2 +- hack/Makefile | 8 +++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint_and_test.yaml b/.github/workflows/lint_and_test.yaml index 1d6dc2dd97..e0426ed01b 100644 --- a/.github/workflows/lint_and_test.yaml +++ b/.github/workflows/lint_and_test.yaml @@ -66,7 +66,8 @@ jobs: go install golang.org/x/tools/cmd/goimports@latest - name: Setup lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 + make -f hack/Makefile golangci-lint + #curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 - name: Lint run: | PATH=$PATH:$(go env GOPATH)/bin make check diff --git a/.golangci.yaml b/.golangci.yaml index 4e410587c0..6f28a189a2 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,5 +1,5 @@ run: - go: "1.20" + go: "1.21" timeout: 10m tests: false allow-parallel-runners: true diff --git a/go.mod b/go.mod index 25cd5661db..5f7aa0a630 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/open-component-model/ocm -go 1.20 +go 1.21 replace github.com/spf13/cobra => github.com/open-component-model/cobra v0.0.0-20230329075350-b1fd876abfb9 diff --git a/hack/Makefile b/hack/Makefile index 941fcb6b2e..8949ef69d3 100644 --- a/hack/Makefile +++ b/hack/Makefile @@ -50,7 +50,13 @@ install-requirements: $(deps) $(GOPATH)/bin/goimports .PHONY: golangci-lint golangci-lint: - go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION) + @# no recommended by website + @# go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION) + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCILINT_VERSION) + +.PHONY: golangci-lint-version +golangci-lint-version: + @echo "$(GOLANGCILINT_VERSION)" .PHONY: go-bindata go-bindata: