Programming/golang
golang unused import
구차니
2022. 7. 20. 19:04
import ( "encoding/json" "net/http" "fmt" "io" "github.com/go-resty/resty/v2" "golang.org/x/net/websocket" ) |
./main.go:9:2: imported and not used: "github.com/go-resty/resty/v2" as resty |
밑줄(_) 하나 넣어주면 넘어가긴 한다.
다만, 사용시에는 _를 빼줘야 정상적으로 인식해서 넣으나 마나하니.. 걍 주석처리 하는게 귀찮아도 나을 지도..?
import ( "encoding/json" "net/http" "fmt" "io" _ "github.com/go-resty/resty/v2" "golang.org/x/net/websocket" ) |
[링크 : https://stackoverflow.com/questions/25924749/import-and-not-used-error]
[링크 : https://knight76.tistory.com/entry/golang-imported-and-not-used]