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

Getting error " Failed to run gofmt on" #55

Closed
neerajkoulgoibibo opened this issue Feb 19, 2016 · 3 comments
Closed

Getting error " Failed to run gofmt on" #55

neerajkoulgoibibo opened this issue Feb 19, 2016 · 3 comments

Comments

@neerajkoulgoibibo
Copy link

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
}

qur added a commit that referenced this issue Feb 23, 2016
@qur qur closed this as completed in 9a55c03 Feb 23, 2016
@neerajkoulgoibibo
Copy link
Author

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..

@neerajkoulgoibibo
Copy link
Author

------ 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"

@neerajkoulgoibibo
Copy link
Author

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"

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

1 participant