infobloxopen / atlas-cli

Apache License 2.0
14 stars 45 forks source link

New project with atlas-cli does not compile #104

Open seizadi opened 3 years ago

seizadi commented 3 years ago

Repo Source: https://github.com/seizadi/aws-cost

Steps to reproduce:

Install CLI:

> git clone https://github.com/infobloxopen/atlas-cli.git
> cd atlas-cli
> make

Create App:

❯ atlas init-app  -delve -gateway -health -helm -kind -name aws-cost -registry soheileizadi
Generating protobuf files... done!
Starting mod project... done!
Resolving imports... done!
Initializing git repo... done!

Create Compile Error:

❯ make
github.com/seizadi/aws-cost/pkg/pb/service.proto:7:1: warning: Import github.com/envoyproxy/protoc-gen-validate/validate/validate.proto is unused.
github.com/seizadi/aws-cost/pkg/pb/service.proto:8:1: warning: Import protoc-gen-swagger/options/annotations.proto is unused.
....

Compile Error:

#13 10.57 # github.com/seizadi/aws-cost/cmd/server
#13 10.57 cmd/server/main.go:106:38: cannot use "github.com/grpc-ecosystem/grpc-gateway/runtime".WithForwardResponseOption(forwardResponseOption) (type "github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMuxOption) as type "github.com/grpc-ecosystem/grpc-gateway/v2/runtime".ServeMuxOption in argument to gateway.WithGatewayOptions
#13 10.57 cmd/server/main.go:107:38: cannot use "github.com/grpc-ecosystem/grpc-gateway/runtime".WithIncomingHeaderMatcher(gateway.AtlasDefaultHeaderMatcher()) (type "github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMuxOption) as type "github.com/grpc-ecosystem/grpc-gateway/v2/runtime".ServeMuxOption in argument to gateway.WithGatewayOptions
#13 10.57 cmd/server/main.go:110:52: cannot use pb.RegisterAwsCostHandlerFromEndpoint (type func(context.Context, *"github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMux, string, []grpc.DialOption) error) as type gateway.registerFunc in argument to gateway.WithEndpointRegistration
seizadi commented 3 years ago

The short term fix was to set the version of atlas-app-toolkit to older version...

diff --git a/go.mod b/go.mod
index 49fa49d..9283dec 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
        github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
        github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
        github.com/grpc-ecosystem/grpc-gateway v1.16.0
-       github.com/infobloxopen/atlas-app-toolkit v1.0.0
+       github.com/infobloxopen/atlas-app-toolkit v0.25.2
        github.com/prometheus/client_golang v1.11.0

I can now compile and run the target:

GOROOT=/usr/local/Cellar/go/1.16.5/libexec #gosetup
GOPATH=/Users/seizadi/projects/go-projects #gosetup
/usr/local/Cellar/go/1.16.5/libexec/bin/go build -o /private/var/folders/49/3pxhjsps4fx4q21nkbj1j6n00000gp/T/GoLand/___aws_cost -gcflags all=-N -l . #gosetup
/Applications/GoLand.app/Contents/plugins/go/lib/dlv/mac/dlv --listen=0.0.0.0:50882 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /private/var/folders/49/3pxhjsps4fx4q21nkbj1j6n00000gp/T/GoLand/___aws_cost --
API server listening at: [::]:50882
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1100.0.30..1
 for x86_64.
Got a connection, launched process /private/var/folders/49/3pxhjsps4fx4q21nkbj1j6n00000gp/T/GoLand/___aws_cost (pid = 44103).
WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
        A future release of golang/protobuf will delete this package,
        which has long been excluded from the compatibility promise.

2021/08/11 18:28:28 Serving from default values, environment variables, and/or flags
{"file":"/Users/seizadi/projects/go-projects/src/github.com/seizadi/aws-cost/cmd/server/main.go:89","func":"main.ServeInternal","level":"debug","msg":"serving internal http at \"0.0.0.0:8081\"","time":"2021-08-11T18:28:28-07:00"}
{"file":"/Users/seizadi/projects/go-projects/src/github.com/seizadi/aws-cost/cmd/server/main.go:128","func":"main.ServeExternal","level":"info","msg":"serving gRPC at 0.0.0.0:9090","time":"2021-08-11T18:28:28-07:00"}
{"file":"/Users/seizadi/projects/go-projects/src/github.com/seizadi/aws-cost/cmd/server/main.go:129","func":"main.ServeExternal","level":"info","msg":"serving http at 0.0.0.0:8080","time":"2021-08-11T18:28:28-07:00"}