From 6ba366cdf52dd2d11da18687e683db4bdd66d353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 17 Sep 2024 16:21:47 +0100 Subject: [PATCH] cue/load: deduplicate underscore import of ./pkg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spotted in passing. Harmless, but also unnecessary. Move it to doc.go near the package documentation, which is the closest to a top-level file we have for this package. While here, remove an unnecessary newline in pkg/register.go. Signed-off-by: Daniel Martí Change-Id: I59bca21889158b231600bd1326752abb8fed0262 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201389 TryBot-Result: CUEcueckoo Reviewed-by: Roger Peppe Unity-Result: CUE porcuepine --- cue/load/doc.go | 6 ++++++ cue/load/instances.go | 6 ------ cue/load/loader.go | 6 ------ pkg/register.go | 1 - 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/cue/load/doc.go b/cue/load/doc.go index 6be5c34346b..781c91d02cb 100644 --- a/cue/load/doc.go +++ b/cue/load/doc.go @@ -14,3 +14,9 @@ // Package load loads CUE instances. package load + +// Trigger the unconditional loading of all core builtin packages if load is used. +// This was deemed the simplest way to avoid having to import this line explicitly, +// and thus breaking existing code, for the majority of cases, +// while not introducing an import cycle. +import _ "cuelang.org/go/pkg" diff --git a/cue/load/instances.go b/cue/load/instances.go index afcd5640553..13faef9c2e5 100644 --- a/cue/load/instances.go +++ b/cue/load/instances.go @@ -30,12 +30,6 @@ import ( "cuelang.org/go/internal/mod/modpkgload" "cuelang.org/go/internal/mod/modrequirements" "cuelang.org/go/mod/module" - - // Trigger the unconditional loading of all core builtin packages if load - // is used. This was deemed the simplest way to avoid having to import - // this line explicitly, and thus breaking existing code, for the majority - // of cases, while not introducing an import cycle. - _ "cuelang.org/go/pkg" ) // Instances returns the instances named by the command line arguments 'args'. diff --git a/cue/load/loader.go b/cue/load/loader.go index 8fcb17f8b78..b17ccbaa603 100644 --- a/cue/load/loader.go +++ b/cue/load/loader.go @@ -26,12 +26,6 @@ import ( "cuelang.org/go/cue/errors" "cuelang.org/go/cue/token" "cuelang.org/go/internal/mod/modpkgload" - - // Trigger the unconditional loading of all core builtin packages if load - // is used. This was deemed the simplest way to avoid having to import - // this line explicitly, and thus breaking existing code, for the majority - // of cases, while not introducing an import cycle. - _ "cuelang.org/go/pkg" ) type loader struct { diff --git a/pkg/register.go b/pkg/register.go index e55734acf69..6718dbd3fa3 100644 --- a/pkg/register.go +++ b/pkg/register.go @@ -27,7 +27,6 @@ import ( _ "cuelang.org/go/pkg/encoding/json" _ "cuelang.org/go/pkg/encoding/yaml" _ "cuelang.org/go/pkg/html" - _ "cuelang.org/go/pkg/list" _ "cuelang.org/go/pkg/math" _ "cuelang.org/go/pkg/math/bits"