From f40d2dcca1b613531fd8b096aa841eafd3e9c931 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Wed, 2 Mar 2022 13:28:32 -0500 Subject: [PATCH] Update Go 1.18 code to match RC 1 (#631) --- .github/workflows/build.yaml | 8 ++++---- internal/sbom/mod_1.18.go | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9c94481658..53f578e6f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,12 +23,12 @@ jobs: go-version: '1.17.x' # Use the installed Go version to download and install the latest 1.18 - # beta and replace our existing go with that one. + # release candidate and replace our existing go with that one. - if: ${{ matrix.go-version == '1.18.x' }} run: | - go install golang.org/dl/go1.18beta1@latest - go1.18beta1 download - cp $(which go1.18beta1) $(which go) + go install golang.org/dl/go1.18rc1@latest + go1.18rc1 download + cp $(which go1.18rc1) $(which go) go version - run: | diff --git a/internal/sbom/mod_1.18.go b/internal/sbom/mod_1.18.go index b4d915eec6..0fb7b339e9 100644 --- a/internal/sbom/mod_1.18.go +++ b/internal/sbom/mod_1.18.go @@ -18,16 +18,17 @@ package sbom import ( + "fmt" "runtime/debug" ) type BuildInfo debug.BuildInfo func (bi *BuildInfo) UnmarshalText(data []byte) error { - dbi := (*debug.BuildInfo)(bi) - if err := dbi.UnmarshalText(data); err != nil { - return err + dbi, err := debug.ParseBuildInfo(string(data)) + if err != nil { + return fmt.Errorf("parsing build info: %w", err) } - bi = (*BuildInfo)(dbi) + *bi = BuildInfo(*dbi) return nil }