aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-12-06 12:33:25 +0100
committerBjørn Erik Pedersen <[email protected]>2022-12-06 13:37:08 +0100
commitf97544a83005d55938f6a3747ce3528cc6968f10 (patch)
tree21793538249cf27651bca643419f7b79ce63eac4
parentd8efe085ca8a8bd342bd45cda1d7c8a5f51cc791 (diff)
downloadhugo-f97544a83005d55938f6a3747ce3528cc6968f10.tar.gz
hugo-f97544a83005d55938f6a3747ce3528cc6968f10.zip
Make the hugo env non verbose output slightly more verbose
This is how it may look like with a extended build: ``` hugo v0.107.0-6445b1e9ff963b07c55d9d69cb9abef8ef21fc5d+extended darwin/arm64 BuildDate=2022-12-06T11:21:50Z GOOS="darwin" GOARCH="arm64" GOVERSION="go1.19.3" github.com/sass/libsass="3.6.5" github.com/webmproject/libwebp="v1.2.4" github.com/sass/dart-sass-embedded/protocol="1.1.0" github.com/sass/dart-sass-embedded/compiler="1.56.1" github.com/sass/dart-sass-embedded/implementation="1.56.1" ```
-rw-r--r--commands/env.go8
-rw-r--r--common/hugo/hugo.go38
2 files changed, 30 insertions, 16 deletions
diff --git a/commands/env.go b/commands/env.go
index 65808b1be..0fc509d6d 100644
--- a/commands/env.go
+++ b/commands/env.go
@@ -50,6 +50,14 @@ If you add the -v flag, you will get a full dependency list.
for _, dep := range deps {
jww.FEEDBACK.Printf("%s\n", dep)
}
+ } else {
+ // These are also included in the GetDependencyList above;
+ // always print these as these are most likely the most useful to know about.
+ deps := hugo.GetDependencyListNonGo()
+ for _, dep := range deps {
+ jww.FEEDBACK.Printf("%s\n", dep)
+ }
+
}
return nil
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go
index f463e261d..86a81a5d8 100644
--- a/common/hugo/hugo.go
+++ b/common/hugo/hugo.go
@@ -186,19 +186,38 @@ func getBuildInfo() *buildInfo {
return bInfo
}
+func formatDep(path, version string) string {
+ return fmt.Sprintf("%s=%q", path, version)
+}
+
// GetDependencyList returns a sorted dependency list on the format package="version".
// It includes both Go dependencies and (a manually maintained) list of C(++) dependencies.
func GetDependencyList() []string {
var deps []string
- formatDep := func(path, version string) string {
- return fmt.Sprintf("%s=%q", path, version)
+ bi := getBuildInfo()
+ if bi == nil {
+ return deps
}
+ for _, dep := range bi.Deps {
+ deps = append(deps, formatDep(dep.Path, dep.Version))
+ }
+
+ deps = append(deps, GetDependencyListNonGo()...)
+
+ sort.Strings(deps)
+
+ return deps
+}
+
+// GetDependencyListNonGo returns a list of non-Go dependencies.
+func GetDependencyListNonGo() []string {
+ var deps []string
+
if IsExtended {
deps = append(
deps,
- // TODO(bep) consider adding a DepsNonGo() method to these upstream projects.
formatDep("github.com/sass/libsass", "3.6.5"),
formatDep("github.com/webmproject/libwebp", "v1.2.4"),
)
@@ -211,20 +230,7 @@ func GetDependencyList() []string {
formatDep(dartSassPath+"/compiler", dartSass.CompilerVersion),
formatDep(dartSassPath+"/implementation", dartSass.ImplementationVersion),
)
-
- }
-
- bi := getBuildInfo()
- if bi == nil {
- return deps
}
-
- for _, dep := range bi.Deps {
- deps = append(deps, formatDep(dep.Path, dep.Version))
- }
-
- sort.Strings(deps)
-
return deps
}