Derek
Derek

Reputation: 12378

Importing all external golang modules to one file and then importing from that file?

Is there a way to import external modules into one file and then import from that file?

For example:

// externals.go
import ( 
  Bitbucket "bitbucket.org/user/project"
  Github "github.com/user/project"
)

// main.go
import (
  "externals/Bitbucket"
  "externals/Github"
)

Is the above in some form possible?

Upvotes: 0

Views: 450

Answers (2)

rog
rog

Reputation: 6670

No, this is not possible. It is a specific design goal of Go to make all dependencies explicit.

See http://talks.golang.org/2012/splash.article and section 7 in particular for more detail on this.

Upvotes: 1

Volker
Volker

Reputation: 42433

No. This is not possible, not even with some tricks.

Upvotes: 0

Related Questions