kit icon indicating copy to clipboard operation
kit copied to clipboard

Invalid import path

Open vdieulesaint opened this issue 6 years ago • 3 comments

Hi,

I am facing an issue with the gen. From $GOPATH/src, I run the following commands :

  1. New service

$kit new service bugs

  1. Implementation of a basic method in the service interface :

type BugsService interface { // Add your methods here // e.x: Foo(ctx context.Context,s string)(rs string, err error) Create(ctx context.Context, bug string) error }

  1. Generate MW

kit generate service bugs --dmw

=> Error

`$ kit generate service bugs --dmw panic: Error 5:9: invalid import path: "C:/Users/Vincent/go/src/bugs/pkg/service" while formatting source: // THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!! package endpoint

import ( service "C:/Users/Vincent/go/src/bugs/pkg/service" endpoint "github.com/go-kit/kit/endpoint" )

... `

The import path is absolute instead of relative. There is maybe something wrong with my dev environment.

$ go env set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\Vincent\AppData\Local\go-build set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Users\Vincent\go set GOPROXY= set GORACE= set GOROOT=C:\Go set GOTMPDIR= set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Vincent\AppData\Local\Temp\go-build688545542=/tmp/go-build -gno-record-gcc-switches I will appreciate your help. Vincent

vdieulesaint avatar Apr 19 '19 07:04 vdieulesaint

Hi,

I am facing an issue with the gen. From $GOPATH/src, I run the following commands :

  1. New service

$kit new service bugs

  1. Implementation of a basic method in the service interface :

type BugsService interface { // Add your methods here // e.x: Foo(ctx context.Context,s string)(rs string, err error) Create(ctx context.Context, bug string) error }

  1. Generate MW

kit generate service bugs --dmw

=> Error

`$ kit generate service bugs --dmw panic: Error 5:9: invalid import path: "C:/Users/Vincent/go/src/bugs/pkg/service" while formatting source: // THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!! package endpoint

import ( service "C:/Users/Vincent/go/src/bugs/pkg/service" endpoint "github.com/go-kit/kit/endpoint" )

... `

The import path is absolute instead of relative. There is maybe something wrong with my dev environment.

$ go env set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\Vincent\AppData\Local\go-build set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Users\Vincent\go set GOPROXY= set GORACE= set GOROOT=C:\Go set GOTMPDIR= set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Vincent\AppData\Local\Temp\go-build688545542=/tmp/go-build -gno-record-gcc-switches I will appreciate your help. Vincent

Hi,I can not reproduction your case in my windows environment。I install the git bash on the windows system, and I use the kit tool in the git bash, everything is ok. You can try it.

GrantZheng avatar Jun 17 '19 07:06 GrantZheng

Any update on this

dkundu1 avatar Oct 08 '19 13:10 dkundu1

any update on this

zhouchunli avatar Aug 08 '20 04:08 zhouchunli