Skip to content

Commit

Permalink
migrate to buf
Browse files Browse the repository at this point in the history
  • Loading branch information
nyaxt committed Sep 16, 2024
1 parent 23e4ee9 commit 7ab6552
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 2,386 deletions.
6 changes: 0 additions & 6 deletions .devcontainer/Dockerfile

This file was deleted.

44 changes: 6 additions & 38 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go
{
"name": "Go",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.19, 1.18
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"VARIANT": "1-bullseye",
// Options
// "NODE_VERSION": "lts/*"
}
},
"name": "otaru",
"image": "mcr.microsoft.com/devcontainers/go",
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Configure tool-specific properties.
"postCreateCommand": "./.devcontainer/postCreate.sh",
"remoteUser": "vscode",
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",

"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
Expand All @@ -32,27 +15,12 @@
},
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go"
"golang.go"
]
}
},

"remoteEnv": {
"PATH": "${containerEnv:PATH}:/opt/protoc/bin"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

"postCreateCommand": "./.devcontainer/postCreate.sh",

"mounts": [
"source=${env:HOME}${env:USERPROFILE}/settings/otaru,target=/etc/otaru,type=bind",
"source=/var/otaru,target=/var/otaru,type=bind",
// "source=/var/otaru,target=/var/otaru,type=bind",
],

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
7 changes: 5 additions & 2 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
set -euo pipefail

go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
PREFIX="/usr/local" && \
VERSION="1.41.0" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \
sudo tar -xvzf - -C "${PREFIX}" --strip-components 1
11 changes: 11 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
plugins:
- remote: buf.build/grpc/go
out: .
opt: paths=source_relative
- remote: buf.build/grpc-ecosystem/gateway
out: .
opt: paths=source_relative
- remote: protocolbuffers/go
out: .
opt: paths=source_relative
6 changes: 6 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/googleapis/googleapis
commit: e7f8d366f5264595bcc4cd4139af9973
digest: b5:0cd69a689ee320ed815663d57d1bc3a1d6823224a7a717d46fee3a68197c25a6f5f932c0b0e49f8370c70c247a6635969a6a54af5345cafd51e0667298768aca
9 changes: 9 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: v2
breaking:
use:
- FILE
lint:
use:
- STANDARD
deps:
- buf.build/googleapis/googleapis
2 changes: 0 additions & 2 deletions facade/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/nyaxt/otaru/apiserver"
"github.com/nyaxt/otaru/assets/webui"
"github.com/nyaxt/otaru/otaruapiserver"
"github.com/nyaxt/otaru/pb/json"
"go.uber.org/zap"
)

Expand All @@ -20,7 +19,6 @@ func (o *Otaru) buildApiServerOptions(cfg *ApiServerConfig) ([]apiserver.Option,
apiserver.ClientCACert(cfg.ClientCACert),
apiserver.CORSAllowedOrigins(cfg.CORSAllowedOrigins),
apiserver.SetDefaultHandler(webui.WebUIHandler(override, "/index.otaru-server.html")),
apiserver.SetSwaggerJson(json.Assets, "/otaru.swagger.json"),
otaruapiserver.InstallBlobstoreService(o.S, o.DefaultBS, o.CBS),
otaruapiserver.InstallFileHandler(o.FS),
otaruapiserver.InstallFileSystemService(o.FS),
Expand Down
2 changes: 2 additions & 0 deletions gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//go:generate buf generate
package otaru
2 changes: 0 additions & 2 deletions pb/json/assets.go

This file was deleted.

26 changes: 0 additions & 26 deletions pb/json/assets_generate.go

This file was deleted.

184 changes: 0 additions & 184 deletions pb/json/assets_vfsgen.go

This file was deleted.

Loading

0 comments on commit 7ab6552

Please sign in to comment.