go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.56k stars 571 forks source link

Ability to resolve packages like logrus without using aliases #2884

Closed wjimenez5271 closed 7 years ago

wjimenez5271 commented 7 years ago

I'm using an API compatible alternative to the standard go logging library, logrus, however unless I use a import alias like so:

package main

import (
  log "github.com/Sirupsen/logrus"
)

package resolution breaks. I'd like to be able to simply import the package directly

package main

import (
  "github.com/Sirupsen/logrus"
)

and then use the API as usual:

log.Println("foo")

and see the IDE be able to resolve log to the logrus package.

zolotov commented 7 years ago

The package name of logrus package is logrus, not log: https://github.com/sirupsen/logrus/blob/master/logger.go#L1

This is what you can do without alias:

package main

import (
  "github.com/Sirupsen/logrus"
)

func _() {
  logrus.Println("foo")
}