Closed neerajkoulgoibibo closed 8 years ago
Hi Julian,
I happen to use go gin library ( "https://github.com/gin-gonic/gin") ..
Now when i was trying to run
"withmock go test ",
it threw the said error..Even after your fix, the problem persists..
------ Code for CloseNotify() -------
// Implements the http.CloseNotify interface func (w *responseWriter) CloseNotify() <-chan bool { return w.ResponseWriter.(http.CloseNotifier).CloseNotify() }
####################### withmock generates
func (_m *MockResponseWriter) CloseNotify() (http.<-chan bool) { ret := _ctrl.Call(m, "CloseNotify") ret0, := ret[0].(http.<-chan bool) return ret0 }
//////////////////////////////////////////////////////////////////////////
If i change code , as in name the return paramater to say c below
// Implements the http.CloseNotify interface func (w *responseWriter) CloseNotify() ( c <-chan bool) { return w.ResponseWriter.(http.CloseNotifier).CloseNotify() }
withmock generates
func (_m *MockResponseWriter) CloseNotify() <-chan bool { ret := _ctrl.Call(m, "CloseNotify") ret0, := ret[0].(<-chan bool) return ret0 }
which i feel is proper ///////////////
But the problem is I get this error
ERROR: EOF
In essence it deletes code pieces in some packages, say i now get errors like
# github.com/gocql/gocql/internal/murmur vendor/src/github.com/gocql/gocql/internal/murmur/murmur.go:7: imported and not used: "unsafe"
# github.com/gocql/gocql/internal/streams vendor/src/github.com/gocql/gocql/internal/streams/streams.go:6: imported and not used: "math" vendor/src/github.com/gocql/gocql/internal/streams/streams.go:7: imported and not used: "strconv" vendor/src/github.com/gocql/gocql/internal/streams/streams.go:8: imported and not used: "sync/atomic"
And forgot to mention, this is my go env ( i am basically using go lang version go version 'go1.5.3 linux/amd64'
And my go env is
GOARCH="amd64" GOBIN="/home/user/src/myapp/vendor/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/user/src/myapp/vendor/:/home/user/" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GO15VENDOREXPERIMENT="1" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0" CXX="g++" CGO_ENABLED="1"
ERROR: Failed to run gofmt on '/tmp/withmock769721486/path/src/github.com/gin-gonic/gin/gin_ifmocks.go': exit status 2 output: /tmp/withmock769721486/path/src/github.com/gin-gonic/gin/gin_ifmocks.go:99:51: expected 'IDENT', found '<-' /tmp/withmock769721486/path/src/github.com/gin-gonic/gin/gin_ifmocks.go:101:26: expected 'IDENT', found '<-'
This is what is there in gin_ifmocks.go file at line 99 through 103
func (_m *MockResponseWriter) CloseNotify() (http.<-chan bool) { ret := _ctrl.Call(m, "CloseNotify") ret0, := ret[0].(http.<-chan bool) return ret0 }