Question:

Explain how to use custom packages in GO language?

Answer:

If you are making your library a separate go get –table project and if your library is for internal use then you can code like this

  • Under the directory of your project place the directory with library files
  • Refer to the library using its path relative to the root of your workspace consisting the project

For example,

src/

myproject/

mylib/

mylib.go

. . .

main.go

Now, in main.go you could import myprojec/mylib.


Keywords:

© 2017 QuizBucket.org