Skip to content

Commit c69ffc9

Browse files
committed
mise protoc gen go
1 parent c8f33f0 commit c69ffc9

5 files changed

Lines changed: 34 additions & 29 deletions

File tree

.github/actions/setup-all/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ inputs:
7777
description: 'Go version to install'
7878
required: false
7979
default: '1.24'
80-
go-install-protoc-gen-go:
81-
description: 'Install protoc-gen-go'
82-
required: false
83-
default: 'true'
8480
go-install-goimports:
8581
description: 'Install goimports'
8682
required: false

.github/actions/setup-go/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ inputs:
66
description: "Go version to install"
77
required: false
88
default: "1.23.11"
9-
install-protoc-gen-go:
10-
description: "Install protoc-gen-go"
11-
required: false
12-
default: "true"
139
cache:
1410
description: "Enable Go module caching"
1511
required: false
@@ -53,12 +49,6 @@ runs:
5349
fi
5450
shell: bash
5551

56-
- name: Install protoc-gen-go
57-
if: inputs.install-protoc-gen-go == 'true'
58-
# locked to match the version in mise.toml
59-
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.6
60-
shell: bash
61-
6252
- name: Install goimports
6353
if: inputs.install-goimports == 'true'
6454
run: go install golang.org/x/tools/cmd/goimports@latest

.github/workflows/build-cli-release.reusable.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
required: false
1515
push:
1616
branches:
17-
- protoc-fix
17+
- sam/mise-protoc-gen-go
1818
env:
1919
MACOSX_DEPLOYMENT_TARGET: "10.13"
2020
# Turbo remote caching
@@ -82,18 +82,10 @@ jobs:
8282
- name: Setup Go
8383
uses: ./.github/actions/setup-go
8484

85-
- name: Install protoc-gen-go into .cargo/bin
86-
shell: bash
87-
run: |
88-
# The cross-compile environment sanitizes the PATH, so we install the plugin
89-
# directly into a directory that is guaranteed to be in the PATH for cargo.
90-
# We also create a symlink from the go/bin to the cargo/bin for consistency.
91-
mkdir -p .cargo/bin
92-
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
93-
go install golang.org/x/tools/cmd/goimports@latest
94-
cp "$HOME/go/bin/protoc-gen-go" ".cargo/bin/"
95-
echo "Installed protoc-gen-go into .cargo/bin:"
96-
ls -la .cargo/bin
85+
86+
- uses: jdx/mise-action@v2
87+
with:
88+
install_args: "protoc-gen-go"
9789

9890
- name: Test protoc-gen-go availability
9991
id: protoc_gen_go_setup

engine/language_client_cffi/build.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,33 @@ fn main() -> std::io::Result<()> {
361361
// Allow overriding the protoc-gen-go plugin path
362362
if let Ok(path) = std::env::var("PROTOC_GEN_GO_PATH") {
363363
protoc.plugin(&path);
364+
} else {
365+
// Try to find protoc-gen-go using mise
366+
match std::process::Command::new("mise")
367+
.args(["which", "protoc-gen-go"])
368+
.output()
369+
{
370+
Ok(output) if output.status.success() => {
371+
let path = String::from_utf8_lossy(&output.stdout);
372+
if !path.is_empty() {
373+
eprintln!("Using protoc-gen-go from mise: {}", path);
374+
protoc.plugin(path.trim());
375+
} else {
376+
eprintln!("protoc-gen-go fallback: mise which returned empty path, relying on PATH");
377+
}
378+
}
379+
Ok(_) => {
380+
eprintln!(
381+
"protoc-gen-go fallback: mise which protoc-gen-go failed, relying on PATH"
382+
);
383+
}
384+
Err(e) => {
385+
eprintln!(
386+
"protoc-gen-go fallback: mise command failed ({}), relying on PATH",
387+
e
388+
);
389+
}
390+
}
364391
}
365392

366393
protoc

mise.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ node = "lts" # For pnpm
1616

1717
# Go tools
1818
# locked to match the version in .github/actions/setup-go/action.yml
19-
"go:google.golang.org/protobuf/cmd/protoc-gen-go" = "v1.36.6"
19+
"protoc-gen-go" = "v1.34.1"
2020
"go:golang.org/x/tools/cmd/goimports" = "latest"
2121
"go:github.com/chrishrb/go-grip" = "latest"
2222

@@ -33,4 +33,4 @@ node = "lts" # For pnpm
3333

3434
[settings]
3535
experimental = true
36-
# idiomatic_version_file_enable_tools = ["node", "python", "ruby", "go"]
36+
# idiomatic_version_file_enable_tools = ["node", "python", "ruby", "go"]

0 commit comments

Comments
 (0)