Skip to content

Commit 3ddedc0

Browse files
author
Kazuyoshi Kato
committed
Remove GOPATH
xxx Signed-off-by: Kazuyoshi Kato <kaz@fly.io>
1 parent 7e123b2 commit 3ddedc0

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
- name: Setup environment
4242
shell: bash
4343
run: |
44-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
4544
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
4645
4746
- name: Check out code
@@ -69,7 +68,6 @@ jobs:
6968
- name: Setup environment
7069
shell: bash
7170
run: |
72-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
7371
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
7472
7573
- name: Check out code
@@ -118,7 +116,6 @@ jobs:
118116
- name: Setup environment
119117
shell: bash
120118
run: |
121-
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
122119
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
123120
124121
- name: Check out code

Protobuild.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,6 @@ target = "examples/next.pb.txt"
136136
# [[descriptors]]
137137
# target = "examples/foo/descriptors.pb.txt"
138138
# prefix = "github.com/containerd/protobuild/examples/foo"
139+
140+
[parameters.go]
141+
paths = "source_relative"

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ func main() {
194194
includes = append(includes, gopathJoin(gopath, pkg))
195195
}
196196

197-
includes = append(includes, gopath)
197+
includes = append(includes, pkg.Dir)
198198
includes = append(includes, c.Includes.After...)
199199

200200
protoc := protocCmd{
201-
Generators: generators(c.Generators, outputDir),
201+
Generators: generators(c.Generators, pkg.Dir),
202202
Files: pkg.ProtoFiles,
203203
OutputDir: outputDir,
204204
Includes: includes,
@@ -246,7 +246,7 @@ func main() {
246246
}
247247

248248
var (
249-
genDescriptors = shouldGenerateDescriptors(importDirPath)
249+
genDescriptors = shouldGenerateDescriptors(pkg.GoImportPath)
250250
dfp *os.File // tempfile for descriptors
251251
)
252252

@@ -291,7 +291,7 @@ func main() {
291291
}
292292

293293
for path, set := range descriptorSets {
294-
if strings.HasPrefix(importDirPath, path) {
294+
if strings.HasPrefix(pkg.GoImportPath, path) {
295295
set.add(desc.File...)
296296
}
297297
}

v2.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ generators = ["go", "go-grpc"]
88
[[descriptors]]
99
prefix = "github.com/containerd/protobuild/examples/v2"
1010
target = "examples/v2/next.pb.txt"
11+
12+
# The default mode is paths=import which makes a directory that mirrors its Go import path.
13+
# https://protobuf.dev/reference/go/go-generated/
14+
[parameters.go]
15+
paths = "source_relative"

0 commit comments

Comments
 (0)