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

imports error: tools file for go install command #92

Open
sioncojp opened this issue Nov 17, 2022 · 1 comment
Open

imports error: tools file for go install command #92

sioncojp opened this issue Nov 17, 2022 · 1 comment

Comments

@sioncojp
Copy link

$ cat tools.go
// +build tools

package tools

import (
	_ "github.com/incu6us/goimports-reviser"
)

This is the file for go install to keep it from disappearing with go mod tidy.
See below for details

Running this file with the -rm-unused option will result in an error.

$ goimports-reviser -company-prefixes "github.com/xxx" -project-name -rm-unused -imports-order std,company,project,general -file-path tools.go
2022/11/17 10:49:55 internal error: go list gives conflicting information for package github.com/xxx/api [github.com/xxx/api.test]
main.main
	/Users/sion_cojp/work/go/pkg/mod/github.com/incu6us/goimports-reviser/[email protected]/main.go:330
runtime.main
	/Users/sion_cojp/.goenv/versions/1.18.0/src/runtime/proc.go:250
runtime.goexit
	/Users/sion_cojp/.goenv/versions/1.18.0/src/runtime/asm_arm64.s:1259

Is there any way to avoid this error?

@haunt98
Copy link

haunt98 commented Nov 23, 2022

I also get this error too, with build.go exist

//go:build tools
// +build tools

package main

import (
	_ "github.com/envoyproxy/protoc-gen-validate"
	_ "github.com/golang/protobuf/protoc-gen-go"
	_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
	_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger"
	_ "github.com/kei2100/protoc-gen-marshal-zap/plugin/protoc-gen-marshal-zap"
)

Looks like we need to ignore build tools

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