Code Monkey home page Code Monkey logo

Comments (3)

GrantZheng avatar GrantZheng commented on August 22, 2024

@kaisawind Hi, I can not reproduce the problem ,could you show some details:

  1. go version;
  2. go env;
  3. the command for installing the kit;
  4. the command for creating the service ;
  5. the detail of your service file;
    thanks:)

from kit.

kaisawind avatar kaisawind commented on August 22, 2024
  • go info
# go version
go version go1.14.5 linux/amd64
# go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pana/.cache/go-build"
GOENV="/home/pana/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY="dev.yunxing.tech,github.com/kaisawind"
GONOSUMDB="dev.yunxing.tech,github.com/kaisawind"
GOOS="linux"
GOPATH="/home/pana/go"
GOPRIVATE="dev.yunxing.tech,github.com/kaisawind"
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build973303776=/tmp/go-build -gno-record-gcc-switches"
  • install kit
git clone https://github.com/GrantZheng/kit.git
cd kit
go install 
  • create service
kit n s -b /home/pana/go/src/github.com/kaisawind/iotx -m github.com/kaisawind/iotx/device
# change service file(Add ping api)
kit g s device              # ok
kit g s device --dmw  # error happend
kit g s device -t grpc # ok
kit g c device              # ok
  • service file
package service

import "context"

// DeviceService describes the service.
type DeviceService interface {
	// Add your methods here
	Ping(ctx context.Context, s string) (rs string, err error)
}

type basicDeviceService struct{}

func (b *basicDeviceService) Ping(ctx context.Context, s string) (rs string, err error) {
	// TODO implement the business logic of Ping
	return rs, err
}

// NewBasicDeviceService returns a naive, stateless implementation of DeviceService.
func NewBasicDeviceService() DeviceService {
	return &basicDeviceService{}
}

// New returns a DeviceService with all of the expected middleware wired in.
func New(middleware []Middleware) DeviceService {
	var svc DeviceService = NewBasicDeviceService()
	for _, m := range middleware {
		svc = m(svc)
	}
	return svc
}

from kit.

GrantZheng avatar GrantZheng commented on August 22, 2024
  • go info
# go version
go version go1.14.5 linux/amd64
# go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pana/.cache/go-build"
GOENV="/home/pana/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY="dev.yunxing.tech,github.com/kaisawind"
GONOSUMDB="dev.yunxing.tech,github.com/kaisawind"
GOOS="linux"
GOPATH="/home/pana/go"
GOPRIVATE="dev.yunxing.tech,github.com/kaisawind"
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build973303776=/tmp/go-build -gno-record-gcc-switches"
  • install kit
git clone https://github.com/GrantZheng/kit.git
cd kit
go install 
  • create service
kit n s -b /home/pana/go/src/github.com/kaisawind/iotx -m github.com/kaisawind/iotx/device
# change service file(Add ping api)
kit g s device              # ok
kit g s device --dmw  # error happend
kit g s device -t grpc # ok
kit g c device              # ok
  • service file
package service

import "context"

// DeviceService describes the service.
type DeviceService interface {
	// Add your methods here
	Ping(ctx context.Context, s string) (rs string, err error)
}

type basicDeviceService struct{}

func (b *basicDeviceService) Ping(ctx context.Context, s string) (rs string, err error) {
	// TODO implement the business logic of Ping
	return rs, err
}

// NewBasicDeviceService returns a naive, stateless implementation of DeviceService.
func NewBasicDeviceService() DeviceService {
	return &basicDeviceService{}
}

// New returns a DeviceService with all of the expected middleware wired in.
func New(middleware []Middleware) DeviceService {
	var svc DeviceService = NewBasicDeviceService()
	for _, m := range middleware {
		svc = m(svc)
	}
	return svc
}

Thank you for providing me information. I can reproduce the case, and you could use it without -b flag first. I will fix it as soon as possible. :)

from kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.