Skip to content

Commit 34105fb

Browse files
authored
build: track tools dependancy in submodule (#56)
* build: track tools dependancy in submodule allow for dependency updates and easier maintenance * build: update go version * lint: format tools file
1 parent 249afb3 commit 34105fb

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ test:
55
go test -v -race ./...
66

77
fmt:
8-
go run golang.org/x/tools/cmd/goimports@v0.21.0 -w .
8+
go run -modfile=tools/go.mod golang.org/x/tools/cmd/goimports -w .
99

1010
gomodtidy:
1111
go mod tidy -v
1212

1313
fieldalignment:
14-
go run golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@v0.21.0 -test=false $(shell go list ./... | grep -v test)
14+
go run -modfile=tools/go.mod golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment -test=false $(shell go list ./... | grep -v test)
1515

1616
update-licenses:
17-
go run github.com/elastic/go-licenser@v0.4.1 -ext .go .
17+
go run -modfile=tools/go.mod github.com/elastic/go-licenser -ext .go .

tools/go.mod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module github.com/elastic/opentelemetry-lib/tools
2+
3+
go 1.21
4+
5+
require (
6+
github.com/elastic/go-licenser v0.4.2
7+
golang.org/x/tools v0.23.0
8+
)
9+
10+
require (
11+
golang.org/x/mod v0.19.0 // indirect
12+
golang.org/x/sync v0.7.0 // indirect
13+
)

tools/go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/elastic/go-licenser v0.4.2 h1:bPbGm8bUd8rxzSswFOqvQh1dAkKGkgAmrPxbUi+Y9+A=
2+
github.com/elastic/go-licenser v0.4.2/go.mod h1:W8eH6FaZDR8fQGm+7FnVa7MxI1b/6dAqxz+zPB8nm5c=
3+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
4+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
5+
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
6+
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
7+
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
8+
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
9+
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
10+
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=

tools/tools.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
// This file creates dependencies on build/test tools, so we can
19+
// track them in go.mod. See:
20+
// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
21+
22+
//go:build tools
23+
// +build tools
24+
25+
package main
26+
27+
import (
28+
_ "golang.org/x/tools/cmd/goimports" //go.mod/go.sum
29+
_ "golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment" //go.mod/go.sum
30+
31+
_ "github.com/elastic/go-licenser" // go.mod/go.sum
32+
)

0 commit comments

Comments
 (0)