Skip to content

Commit

Permalink
Update tours for new config files (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Snyder <[email protected]>
  • Loading branch information
rakuista and nicksnyder authored May 17, 2024
1 parent 1bea4de commit d4bf43e
Show file tree
Hide file tree
Showing 34 changed files with 317 additions and 217 deletions.
17 changes: 10 additions & 7 deletions finish/getting-started-with-bsr/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
version: v1
version: v2
managed:
enabled: true
go_package_prefix:
default: github.com/bufbuild/buf-tour/gen
except:
- buf.build/googleapis/googleapis
disable:
- module: buf.build/googleapis/googleapis
override:
- file_option: go_package_prefix
value: github.com/bufbuild/buf-tour/gen
plugins:
- plugin: buf.build/protocolbuffers/go
- remote: buf.build/protocolbuffers/go
out: gen
opt: paths=source_relative
- plugin: buf.build/bufbuild/connect-go
- remote: buf.build/connectrpc/go
out: gen
opt: paths=source_relative
inputs:
- directory: proto
6 changes: 6 additions & 0 deletions finish/getting-started-with-bsr/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: 4ed3bc159a8b4ac68fe253218760d035
digest: b5:74a7798987b123218c004cf28543a2835e432ca04a69de99cd394a29dbad24d9ed38344f0b7c97ad6476039506c4eb38c2f4a8eef9cec3da2e38e4216a22d495
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
version: v1
name: buf.build/<USER>/petapis
deps:
- buf.build/googleapis/googleapis
breaking:
use:
- FILE
version: v2
modules:
- path: proto
name: buf.build/<username>/petapis
lint:
use:
- DEFAULT
breaking:
use:
- FILE
deps:
- buf.build/googleapis/googleapis
11 changes: 6 additions & 5 deletions finish/getting-started-with-bsr/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import (
"log"
"net/http"

"buf.build/gen/go/<USER>/petapis/bufbuild/connect-go/pet/v1/petv1connect"
petv1 "buf.build/gen/go/<USER>/petapis/protocolbuffers/go/pet/v1"
"github.com/bufbuild/connect-go"
// Replace <USERNAME> with your BSR username if username isn't present
"buf.build/gen/go/:username/petapis/connectrpc/go/pet/v1/petv1connect"
petv1 "buf.build/gen/go/:username/petapis/protocolbuffers/go/pet/v1"
connect "connectrpc.com/connect"
)

func main() {
client := petv1connect.NewPetStoreServiceClient(
http.DefaultClient,
"http://localhost:8080",
)
_, err := client.PutPet(
res, err := client.PutPet(
context.Background(),
connect.NewRequest(&petv1.PutPetRequest{
PetType: petv1.PetType_PET_TYPE_SNAKE,
Expand All @@ -26,5 +27,5 @@ func main() {
log.Println(err)
return
}
log.Println("Successfully PutPet")
log.Println(res.Msg, "Successfully PutPet")
}
2 changes: 1 addition & 1 deletion finish/getting-started-with-bsr/gen/pet/v1/pet.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 86 additions & 45 deletions finish/getting-started-with-bsr/gen/pet/v1/petv1connect/pet.connect.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions finish/getting-started-with-bsr/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/bufbuild/buf-tour

go 1.19
go 1.22.2

require (
buf.build/gen/go/<USER>/petapis/bufbuild/connect-go v1.5.1-20230210174710-1256c735ed27.1
buf.build/gen/go/<USER>/petapis/protocolbuffers/go v1.28.1-20230210174710-1256c735ed27.4
github.com/bufbuild/connect-go v1.5.1
golang.org/x/net v0.6.0
google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc
google.golang.org/protobuf v1.28.1
buf.build/gen/go/<USERNAME>/petapis/connectrpc/go v1.16.1-20240424002215-e3c35074dc9a.1
buf.build/gen/go/<USERNAME>/petapis/protocolbuffers/go v1.33.0-20240424002215-e3c35074dc9a.1
connectrpc.com/connect v1.16.1
golang.org/x/net v0.24.0
google.golang.org/genproto v0.0.0-20240429193739-8cf5692501f6
google.golang.org/protobuf v1.33.0
)

require golang.org/x/text v0.7.0 // indirect
require golang.org/x/text v0.14.0 // indirect
3 changes: 3 additions & 0 deletions finish/getting-started-with-bsr/proto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## PetAPIs

This module contains all the APIs required to interact with the `PetStoreService`.
7 changes: 0 additions & 7 deletions finish/getting-started-with-bsr/proto/buf.lock

This file was deleted.

4 changes: 0 additions & 4 deletions finish/getting-started-with-bsr/proto/buf.md

This file was deleted.

2 changes: 1 addition & 1 deletion finish/getting-started-with-bsr/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"log"
"net/http"

connect "connectrpc.com/connect"
petv1 "github.com/bufbuild/buf-tour/gen/pet/v1"
"github.com/bufbuild/buf-tour/gen/pet/v1/petv1connect"
"github.com/bufbuild/connect-go"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
Expand Down
13 changes: 8 additions & 5 deletions finish/getting-started-with-buf-cli/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
version: v1
version: v2
managed:
enabled: true
go_package_prefix:
default: github.com/bufbuild/buf-tour/gen
override:
- file_option: go_package_prefix
value: github.com/bufbuild/buf-tour/gen
plugins:
- plugin: buf.build/protocolbuffers/go
- remote: buf.build/protocolbuffers/go
out: gen
opt: paths=source_relative
- plugin: buf.build/bufbuild/connect-go
- remote: buf.build/connectrpc/go
out: gen
opt: paths=source_relative
inputs:
- directory: proto
11 changes: 11 additions & 0 deletions finish/getting-started-with-buf-cli/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v2
modules:
- path: proto
lint:
use:
- DEFAULT
ignore:
- proto/google/type/datetime.proto
breaking:
use:
- FILE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d4bf43e

Please sign in to comment.