Skip to content

Commit 4b45f27

Browse files
authored
Add notice generator target to mage and a NOTICE.txt file (#38)
1 parent 7585bbc commit 4b45f27

File tree

17 files changed

+23587
-3
lines changed

17 files changed

+23587
-3
lines changed

NOTICE.txt

Lines changed: 22665 additions & 0 deletions
Large diffs are not rendered by default.

dev-tools/mage/deps.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package mage
219

320
import (
421
"fmt"
522

623
"github.com/magefile/mage/mg"
7-
"github.com/magefile/mage/sh"
24+
25+
"github.com/elastic/elastic-agent-libs/dev-tools/mage/gotool"
826
)
927

1028
// Deps contains targets related to checking dependencies
1129
type Deps mg.Namespace
1230

1331
// CheckModuleTidy checks if `go mod tidy` was run before the last commit.
1432
func (Deps) CheckModuleTidy() error {
15-
err := sh.Run("go", "mod", "tidy")
33+
err := gotool.Mod.Tidy()
1634
if err != nil {
1735
return err
1836
}

dev-tools/mage/gotool/get.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package gotool
19+
20+
type goGet func(opts ...ArgOpt) error
21+
type goDownload func(opts ...ArgOpt) error
22+
23+
// Get runs `go get` and provides optionals for adding command line arguments.
24+
var Get goGet = runGoGet
25+
26+
func runGoGet(opts ...ArgOpt) error {
27+
args := buildArgs(opts)
28+
return runVGo("get", args)
29+
}
30+
31+
func (goGet) Download() ArgOpt { return flagBoolIf("-d", true) }
32+
func (goGet) Update() ArgOpt { return flagBoolIf("-u", true) }
33+
func (goGet) Package(pkg string) ArgOpt { return posArg(pkg) }
34+
35+
// Download runs `go download` and provides optionals for adding command line arguments.
36+
var Download goDownload = runGoDownload
37+
38+
func runGoDownload(opts ...ArgOpt) error {
39+
args := buildArgs(opts)
40+
return runVGo("download", args)
41+
}
42+
43+
func (goDownload) All() ArgOpt { return posArg("all") }

0 commit comments

Comments
 (0)