Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: illegal line number (line numbering starts at 1) #7

Open
kaisawind opened this issue Aug 1, 2020 · 3 comments
Open

panic: illegal line number (line numbering starts at 1) #7

kaisawind opened this issue Aug 1, 2020 · 3 comments

Comments

@kaisawind
Copy link

kit g s device --dmw

深度截图_选择区域_20200802042848

@GrantZheng
Copy link
Owner

@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:)

@kaisawind
Copy link
Author

  • 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
}

@GrantZheng
Copy link
Owner

  • 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. :)

poppyred pushed a commit to poppyred/kit that referenced this issue Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants