Golang Import and Export Struct Packages and Interfaces


How to Import struct from another or child package?

You will learn to create your own package and import your custom package. In this example, you will see how to import structure from another or child package. You will also be able to call functions of custom packages from the main package.

Example Explained


Dereferencing a pointer from another package

This example aims to demonstrate declaration of a pointer and accessing the value of the variable which the pointer points to.

Example Explained


How to import and alias package names?

Go also has the ability to alias package names. This example aims to demonstrate the importance of the use of alias package names in our Go programs.

Example Explained


How to implement interfaces from a different packages?

This example aims to demonstrate the implementation of interfaces in Go and import your custom package. You will be able to define and declare an interface for an application in custom packages and implement that interface in your applications.

Example Explained


How to call a function from another package?

This example aims to demonstrate the various calls of a function in detail. You will learn to create and call a custom package function in main package. You will also be able to call functions of custom packages from the another package using alias.

Example Explained