test
continuous-integration/drone/push Build was killed Details

master
icechen 2021-12-29 23:27:19 +08:00
parent eee7882557
commit 41daeab7b0
5 changed files with 5 additions and 10 deletions

View File

@ -9,7 +9,6 @@ WORKDIR /go/src
ADD . . ADD . .
RUN go mod tidy RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o api_example_api ./app/api/example_api RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o api_example_api ./app/api/example_api
FROM alpine as example_api FROM alpine as example_api
WORKDIR /go/src WORKDIR /go/src
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo

View File

@ -1,6 +1,8 @@
package main package main
import "git.icechen.cn/pkg/go-template/app/service/example_service/pkg/user" import (
"git.icechen.cn/pkg/go-template/app/service/example_service/internal/user"
)
func main() { func main() {
user.RpcServer() user.RpcServer()

View File

@ -1,7 +0,0 @@
package user2
import "fmt"
func CreateUser() {
fmt.Println("create user")
}

View File

@ -3,11 +3,12 @@ package rpc
import ( import (
"google.golang.org/grpc" "google.golang.org/grpc"
"os" "os"
"strings"
) )
// GetServiceConn 获取服务的连接 // GetServiceConn 获取服务的连接
func GetServiceConn(serviceName string) *grpc.ClientConn { func GetServiceConn(serviceName string) *grpc.ClientConn {
target := os.Getenv("SERVICE_" + serviceName) target := strings.ToUpper(os.Getenv("SERVICE_" + serviceName))
cli, _ := grpc.Dial(target, grpc.WithInsecure()) cli, _ := grpc.Dial(target, grpc.WithInsecure())
return cli return cli
} }