Skip to content

Commit b1bbe49

Browse files
committed
Update licenses for go-version-1.8.0 bump
1 parent 23b42da commit b1bbe49

15 files changed

Lines changed: 169 additions & 75 deletions

third-party-licenses.darwin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Some packages may only be included on certain architectures or operating systems
118118
- [github.com/gorilla/css/scanner](https://pkg.go.dev/github.com/gorilla/css/scanner) ([BSD-3-Clause](https://github.com/gorilla/css/blob/v1.0.1/LICENSE))
119119
- [github.com/gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) ([BSD-2-Clause](https://github.com/gorilla/websocket/blob/v1.5.3/LICENSE))
120120
- [github.com/grpc-ecosystem/grpc-gateway/v2](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/v2) ([BSD-3-Clause](https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.27.2/LICENSE))
121-
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.7.0/LICENSE))
121+
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.8.0/LICENSE))
122122
- [github.com/hashicorp/golang-lru/v2](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2) ([MPL-2.0](https://github.com/hashicorp/golang-lru/blob/v2.0.7/LICENSE))
123123
- [github.com/hashicorp/golang-lru/v2/simplelru](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2/simplelru) ([BSD-3-Clause](https://github.com/hashicorp/golang-lru/blob/v2.0.7/simplelru/LICENSE_list))
124124
- [github.com/henvic/httpretty](https://pkg.go.dev/github.com/henvic/httpretty) ([MIT](https://github.com/henvic/httpretty/blob/v0.1.4/LICENSE.md))

third-party-licenses.linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Some packages may only be included on certain architectures or operating systems
118118
- [github.com/gorilla/css/scanner](https://pkg.go.dev/github.com/gorilla/css/scanner) ([BSD-3-Clause](https://github.com/gorilla/css/blob/v1.0.1/LICENSE))
119119
- [github.com/gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) ([BSD-2-Clause](https://github.com/gorilla/websocket/blob/v1.5.3/LICENSE))
120120
- [github.com/grpc-ecosystem/grpc-gateway/v2](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/v2) ([BSD-3-Clause](https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.27.2/LICENSE))
121-
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.7.0/LICENSE))
121+
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.8.0/LICENSE))
122122
- [github.com/hashicorp/golang-lru/v2](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2) ([MPL-2.0](https://github.com/hashicorp/golang-lru/blob/v2.0.7/LICENSE))
123123
- [github.com/hashicorp/golang-lru/v2/simplelru](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2/simplelru) ([BSD-3-Clause](https://github.com/hashicorp/golang-lru/blob/v2.0.7/simplelru/LICENSE_list))
124124
- [github.com/henvic/httpretty](https://pkg.go.dev/github.com/henvic/httpretty) ([MIT](https://github.com/henvic/httpretty/blob/v0.1.4/LICENSE.md))

third-party-licenses.windows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Some packages may only be included on certain architectures or operating systems
119119
- [github.com/gorilla/css/scanner](https://pkg.go.dev/github.com/gorilla/css/scanner) ([BSD-3-Clause](https://github.com/gorilla/css/blob/v1.0.1/LICENSE))
120120
- [github.com/gorilla/websocket](https://pkg.go.dev/github.com/gorilla/websocket) ([BSD-2-Clause](https://github.com/gorilla/websocket/blob/v1.5.3/LICENSE))
121121
- [github.com/grpc-ecosystem/grpc-gateway/v2](https://pkg.go.dev/github.com/grpc-ecosystem/grpc-gateway/v2) ([BSD-3-Clause](https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.27.2/LICENSE))
122-
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.7.0/LICENSE))
122+
- [github.com/hashicorp/go-version](https://pkg.go.dev/github.com/hashicorp/go-version) ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.8.0/LICENSE))
123123
- [github.com/hashicorp/golang-lru/v2](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2) ([MPL-2.0](https://github.com/hashicorp/golang-lru/blob/v2.0.7/LICENSE))
124124
- [github.com/hashicorp/golang-lru/v2/simplelru](https://pkg.go.dev/github.com/hashicorp/golang-lru/v2/simplelru) ([BSD-3-Clause](https://github.com/hashicorp/golang-lru/blob/v2.0.7/simplelru/LICENSE_list))
125125
- [github.com/henvic/httpretty](https://pkg.go.dev/github.com/henvic/httpretty) ([MIT](https://github.com/henvic/httpretty/blob/v0.1.4/LICENSE.md))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Each line is a file pattern followed by one or more owners.
2+
# More on CODEOWNERS files: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
3+
4+
# Default owner
5+
* @hashicorp/team-ip-compliance
6+
7+
# Add override rules below. Each line is a file/folder pattern followed by one or more owners.
8+
# Being an owner means those groups or individuals will be added as reviewers to PRs affecting
9+
# those areas of the code.
10+
# Examples:
11+
# /docs/ @docs-team
12+
# *.js @js-team
13+
# *.go @go-team

third-party/github.com/hashicorp/go-version/.github/dependabot.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ updates:
1212
interval: monthly
1313
labels:
1414
- dependencies
15-
# only update HashiCorp actions, external actions managed by TSCCR
16-
allow:
17-
- dependency-name: hashicorp/*
1815
groups:
1916
github-actions-breaking:
2017
update-types:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!-- heimdall_github_prtemplate:grc-pci_dss-2024-01-05 -->
2+
## Description
3+
4+
<!-- Provide a summary of what the PR does and why it is being submitted. -->
5+
6+
## Related Issue
7+
8+
<!-- If this PR is linked to any issue, provide the issue number or description here. Any related JIRA tickets can also be added here. -->
9+
10+
## How Has This Been Tested?
11+
12+
<!-- Describe how the changes have been tested. Provide test instructions or details. -->

third-party/github.com/hashicorp/go-version/.github/workflows/go-tests.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515

1616
steps:
1717
- name: Setup go
18-
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
18+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
1919
with:
2020
go-version: ${{ matrix.go-version }}
2121

2222
- name: Checkout code
23-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2424

2525
- name: Create test directory
2626
run: |
@@ -30,7 +30,7 @@ jobs:
3030
run: go mod download
3131

3232
- name: Cache / restore go modules
33-
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
33+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
3434
with:
3535
path: |
3636
~/go/pkg/mod
@@ -48,6 +48,9 @@ jobs:
4848
echo "$files"
4949
exit 1
5050
fi
51+
52+
- name: Run golangci-lint
53+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
5154

5255
# Install gotestsum with go get for 1.15.3; otherwise default to go install
5356
- name: Install gotestsum
@@ -64,11 +67,20 @@ jobs:
6467
- name: Run go tests
6568
run: |
6669
PACKAGE_NAMES=$(go list ./...)
67-
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
70+
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- -p 2 -cover -coverprofile=coverage.out $PACKAGE_NAMES
6871
6972
# Save coverage report parts
7073
- name: Upload and save artifacts
71-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
74+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
75+
with:
76+
name: Test Results-${{matrix.go-version}}
77+
path: ${{ env.TEST_RESULTS }}
78+
79+
- name: Upload coverage report
80+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
7281
with:
73-
name: Test Results
74-
path: ${{ env.TEST_RESULTS }}
82+
path: coverage.out
83+
name: Coverage-report-${{matrix.go-version}}
84+
85+
- name: Display coverage report
86+
run: go tool cover -func=coverage.out

third-party/github.com/hashicorp/go-version/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 HashiCorp, Inc.
1+
Copyright IBM Corp. 2014, 2025
22

33
Mozilla Public License, version 2.0
44

third-party/github.com/hashicorp/go-version/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Versioning Library for Go
2+
23
![Build Status](https://github.com/hashicorp/go-version/actions/workflows/go-tests.yml/badge.svg)
3-
[![GoDoc](https://godoc.org/github.com/hashicorp/go-version?status.svg)](https://godoc.org/github.com/hashicorp/go-version)
4+
[![Go Reference](https://pkg.go.dev/badge/github.com/hashicorp/go-version.svg)](https://pkg.go.dev/github.com/hashicorp/go-version)
45

56
go-version is a library for parsing versions and version constraints,
67
and verifying versions against a set of constraints. go-version
@@ -12,7 +13,7 @@ Versions used with go-version must follow [SemVer](http://semver.org/).
1213
## Installation and Usage
1314

1415
Package documentation can be found on
15-
[GoDoc](http://godoc.org/github.com/hashicorp/go-version).
16+
[Go Reference](https://pkg.go.dev/github.com/hashicorp/go-version).
1617

1718
Installation can be done with a normal `go get`:
1819

third-party/github.com/hashicorp/go-version/constraint.go

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) HashiCorp, Inc.
1+
// Copyright IBM Corp. 2014, 2025
22
// SPDX-License-Identifier: MPL-2.0
33

44
package version
@@ -8,8 +8,26 @@ import (
88
"regexp"
99
"sort"
1010
"strings"
11+
"sync"
1112
)
1213

14+
var (
15+
constraintRegexp *regexp.Regexp
16+
constraintRegexpOnce sync.Once
17+
)
18+
19+
func getConstraintRegexp() *regexp.Regexp {
20+
constraintRegexpOnce.Do(func() {
21+
// This heavy lifting only happens the first time this function is called
22+
constraintRegexp = regexp.MustCompile(fmt.Sprintf(
23+
`^\s*(%s)\s*(%s)\s*$`,
24+
`<=|>=|!=|~>|<|>|=|`,
25+
VersionRegexpRaw,
26+
))
27+
})
28+
return constraintRegexp
29+
}
30+
1331
// Constraint represents a single constraint for a version, such as
1432
// ">= 1.0".
1533
type Constraint struct {
@@ -29,38 +47,11 @@ type Constraints []*Constraint
2947

3048
type constraintFunc func(v, c *Version) bool
3149

32-
var constraintOperators map[string]constraintOperation
33-
3450
type constraintOperation struct {
3551
op operator
3652
f constraintFunc
3753
}
3854

39-
var constraintRegexp *regexp.Regexp
40-
41-
func init() {
42-
constraintOperators = map[string]constraintOperation{
43-
"": {op: equal, f: constraintEqual},
44-
"=": {op: equal, f: constraintEqual},
45-
"!=": {op: notEqual, f: constraintNotEqual},
46-
">": {op: greaterThan, f: constraintGreaterThan},
47-
"<": {op: lessThan, f: constraintLessThan},
48-
">=": {op: greaterThanEqual, f: constraintGreaterThanEqual},
49-
"<=": {op: lessThanEqual, f: constraintLessThanEqual},
50-
"~>": {op: pessimistic, f: constraintPessimistic},
51-
}
52-
53-
ops := make([]string, 0, len(constraintOperators))
54-
for k := range constraintOperators {
55-
ops = append(ops, regexp.QuoteMeta(k))
56-
}
57-
58-
constraintRegexp = regexp.MustCompile(fmt.Sprintf(
59-
`^\s*(%s)\s*(%s)\s*$`,
60-
strings.Join(ops, "|"),
61-
VersionRegexpRaw))
62-
}
63-
6455
// NewConstraint will parse one or more constraints from the given
6556
// constraint string. The string must be a comma-separated list of
6657
// constraints.
@@ -107,7 +98,7 @@ func (cs Constraints) Check(v *Version) bool {
10798
// to '>0.2' it is *NOT* treated as equal.
10899
//
109100
// Missing operator is treated as equal to '=', whitespaces
110-
// are ignored and constraints are sorted before comaparison.
101+
// are ignored and constraints are sorted before comparison.
111102
func (cs Constraints) Equals(c Constraints) bool {
112103
if len(cs) != len(c) {
113104
return false
@@ -176,17 +167,35 @@ func (c *Constraint) String() string {
176167
}
177168

178169
func parseSingle(v string) (*Constraint, error) {
179-
matches := constraintRegexp.FindStringSubmatch(v)
170+
matches := getConstraintRegexp().FindStringSubmatch(v)
180171
if matches == nil {
181-
return nil, fmt.Errorf("Malformed constraint: %s", v)
172+
return nil, fmt.Errorf("malformed constraint: %s", v)
182173
}
183174

184175
check, err := NewVersion(matches[2])
185176
if err != nil {
186177
return nil, err
187178
}
188179

189-
cop := constraintOperators[matches[1]]
180+
var cop constraintOperation
181+
switch matches[1] {
182+
case "=":
183+
cop = constraintOperation{op: equal, f: constraintEqual}
184+
case "!=":
185+
cop = constraintOperation{op: notEqual, f: constraintNotEqual}
186+
case ">":
187+
cop = constraintOperation{op: greaterThan, f: constraintGreaterThan}
188+
case "<":
189+
cop = constraintOperation{op: lessThan, f: constraintLessThan}
190+
case ">=":
191+
cop = constraintOperation{op: greaterThanEqual, f: constraintGreaterThanEqual}
192+
case "<=":
193+
cop = constraintOperation{op: lessThanEqual, f: constraintLessThanEqual}
194+
case "~>":
195+
cop = constraintOperation{op: pessimistic, f: constraintPessimistic}
196+
default:
197+
cop = constraintOperation{op: equal, f: constraintEqual}
198+
}
190199

191200
return &Constraint{
192201
f: cop.f,

0 commit comments

Comments
 (0)