Skip to content

Commit

Permalink
refactor: Update frpc to use latest frisbee polyglot etc apis (#41)
Browse files Browse the repository at this point in the history
* Update dependencies

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Remove debug statement

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Updated fRPC to use latest Polyglot and Frisbee versions
* Upadted dependency versions
* Updated generated code to conform to API changes

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Fix potential newlines in version file breaking code generation

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Bump required go version to 1.20

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Ensure required go version is passed as string because yaml is dumb

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Update polyglot dependency for v2 structure

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Tidy go mods

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Fix go version in workflows

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>

* Remove accidental debug statement

---------

Signed-off-by: Alex Sørlie Glomsaas <[email protected]>
  • Loading branch information
SuperManifolds committed Apr 25, 2024
1 parent 00d25a9 commit 0797eea
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 194 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on: [pull_request]

jobs:
golang:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: '1.21'

- name: Go Build Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: '1.21'

- name: Go Build Cache
uses: actions/cache@v2
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
module github.com/loopholelabs/frpc-go

go 1.18
go 1.21.4

require (
github.com/loopholelabs/frisbee-go v0.7.2
github.com/loopholelabs/polyglot v1.1.2
github.com/loopholelabs/frisbee-go v0.8.0
github.com/loopholelabs/polyglot v1.3.0
github.com/loopholelabs/polyglot/v2 v2.0.0
github.com/loopholelabs/testing v0.2.3
github.com/rs/zerolog v1.30.0
github.com/stretchr/testify v1.8.4
github.com/rs/zerolog v1.32.0
github.com/stretchr/testify v1.9.0
go.uber.org/atomic v1.11.0
google.golang.org/protobuf v1.31.0
google.golang.org/protobuf v1.33.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/loopholelabs/common v0.4.9 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
50 changes: 28 additions & 22 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,51 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/loopholelabs/common v0.4.9 h1:9MPUYlZZ/qx3Kt8LXgXxcSXthrM91od8026c4DlGpAU=
github.com/loopholelabs/common v0.4.9/go.mod h1:Wop5srN1wYT+mdQ9gZ+kn2I9qKAyVd0FB48pThwIa9M=
github.com/loopholelabs/frisbee-go v0.7.2 h1:Gk8yfz2LDN3bTjQ1OQZa+4sAk9WQkHA6j1SuAzIp42A=
github.com/loopholelabs/frisbee-go v0.7.2/go.mod h1:p1VQ3R4mYOKHZ/J52jgogfOawTm0hOZLXnRGBKhF9e0=
github.com/loopholelabs/polyglot v1.1.2 h1:9JE1m/IL8rgWIlykvebz98i4tjOGNOpgGIB3CqbfvrE=
github.com/loopholelabs/polyglot v1.1.2/go.mod h1:EA88BEkIluKHAWxhyOV88xXz68YkRdo9IzZ+1dj+7Ao=
github.com/loopholelabs/frisbee-go v0.8.0 h1:p0ft10GKfBRAbVA5jcz1N4Xy1CJB7Kh14teSZX+Hn0k=
github.com/loopholelabs/frisbee-go v0.8.0/go.mod h1:Dvie8P+/TTeDUMDn7e46mm3Snd/vfltTqqj9CZk1xGo=
github.com/loopholelabs/polyglot v1.3.0 h1:pOQjZHo4X/VEjADkmM2tXHui8NFkOlmaU4D/4W18WK8=
github.com/loopholelabs/polyglot v1.3.0/go.mod h1:w9F5kdv3EzE2r7scpmj29hoySRr7NNLjpeUL4ALMusA=
github.com/loopholelabs/polyglot/v2 v2.0.0 h1:apwXs/A0g/6GEoj/n3+6orKYl17Qj4dSK8azmFuY110=
github.com/loopholelabs/polyglot/v2 v2.0.0/go.mod h1:V9WoilbgAJ3q5MQO4XwGhrmSpufW7XJK7KKESnWI3Mg=
github.com/loopholelabs/testing v0.2.3 h1:4nVuK5ctaE6ua5Z0dYk2l7xTFmcpCYLUeGjRBp8keOA=
github.com/loopholelabs/testing v0.2.3/go.mod h1:gqtGY91soYD1fQoKQt/6kP14OYpS7gcbcIgq5mc9m8Q=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion internal/version/current_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.7.3
v0.8.0
7 changes: 4 additions & 3 deletions pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package generator

import (
"bytes"
"strings"
"text/template"

generator "github.com/loopholelabs/polyglot/generator/golang"
"github.com/loopholelabs/polyglot/utils"
generator "github.com/loopholelabs/polyglot/v2/generator/golang"
"github.com/loopholelabs/polyglot/v2/utils"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down Expand Up @@ -121,7 +122,7 @@ func (g *Generator) Generate(req *pluginpb.CodeGeneratorRequest) (res *pluginpb.
numStreamMethods, numMethods := extractNumberOfMethods(f)

err = templ.ExecuteTemplate(genFile, "prebase.templ", map[string]interface{}{
"pluginVersion": version.Version,
"pluginVersion": strings.TrimSpace(version.Version),
"sourcePath": f.Desc.Path(),
"package": packageName,
"requiredImports": requiredImports,
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package generator
var (
requiredImports = []string{
"errors",
"github.com/loopholelabs/polyglot",
"github.com/loopholelabs/polyglot/v2",
"net",
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package generator
import (
"strings"

"github.com/loopholelabs/polyglot/utils"
"github.com/loopholelabs/polyglot/v2/utils"
"google.golang.org/protobuf/reflect/protoreflect"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/test/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func testServerStreaming(client *Client, t *testing.T) {
ctx := context.Background()
search := NewSearchResponse()
search.Results = []*SearchResponseResult{
&SearchResponseResult{
{
Url: "https://google.com",
Title: "Google",
Snippets: []string{},
Expand Down
Loading

0 comments on commit 0797eea

Please sign in to comment.