percolate / charlatan Goto Github PK
View Code? Open in Web Editor NEWGo Interface Mocking Tool
License: BSD 3-Clause "New" or "Revised" License
Go Interface Mocking Tool
License: BSD 3-Clause "New" or "Revised" License
Similarly named methods can cause auto-generated method naming conflicts. Specifically if an interface has a naming such as:
Field(string, interface{})
FieldNot(string, interface{})
While charlatan does code generation for Field(), it generates FieldCalled() and FieldNotCalled().
When charlatan attempts to generate methods for FieldNot(), it will generate FieldNotCalled() and draw a method definition naming conflict error, as there is already a FieldNotCalled() method defined by code generation for Field().
type Call struct{}
//go:generate charlatan -output ./mockCallsDAL.go CallsDAL
type CallsDAL interface {
Get(id uint64) (call *Call, err error)
}
Expected generated valid go code or some error
In this case, in function "SetGetInvocation" it generates code with a type error.
Package version v1.0.4 ( 4cd615c )
go version go1.10.1 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tomat/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tomat/Projects/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build652025093=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.10.1 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.1
uname -sr: Linux 4.14.34-1-MANJARO
LSB Version: n/a
Distributor ID: ManjaroLinux
Description: Manjaro Linux
Release: 17.1.8
Codename: Hakoila
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.26, by Roland McGrath et al.
type Type struct{}
//go:generate charlatan -output ./mockTypesDAL.go TypesDAL
type TypesDAL interface {
Get(id uint64) (t *Type, err error)
}
Expected generated valid go code or some error
Generated functions "NewFake*" with name conflicts.
I think it because of the first letter of struct name.
Package version v1.0.4 ( 4cd615c )
go version go1.10.1 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tomat/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tomat/Projects/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build652025093=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.10.1 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.1
uname -sr: Linux 4.14.34-1-MANJARO
LSB Version: n/a
Distributor ID: ManjaroLinux
Description: Manjaro Linux
Release: 17.1.8
Codename: Hakoila
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.26, by Roland McGrath et al.
charlatan: cannot find package "gopkg.in/olivere/elastic.v5" in any of:
/usr/local/Cellar/go/1.10.1/libexec/src/gopkg.in/olivere/elastic.v5 (from $GOROOT)
/Users/tmh/go/src/gopkg.in/olivere/elastic.v5 (from $GOPATH)
service.go:49: running "charlatan": exit status 1
related: go-swagger/go-swagger#1681
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.