Golang Tutorial
Introduction Variables Constants Data Type Convert Types Operators If..Else Switch..Case For Loops Functions Variadic Functions Deferred Functions Calls Panic and Recover Arrays Slices Maps Struct Interface Goroutines Channels Concurrency Problems Logs Files and Directories Reading and Writing Files Regular Expression Find DNS records Cryptography Gotchas in Golang Import and Export Best Golang Packages Web Application Goroutines and Channels Exercises Reflection in Golang Golang for beginners Strings in Golang HTTP Client Server Examples Context PackageGolang Reference
Basic Programs Advance Programs Data Structure and Algorithms Date and Time Slice Sort, Reverse, Search Functions String Functions Methods and Objects Interface TypeBeego Framework
Beego Setup Beego Database Migration Beego GET POST Beego RoutingGolang 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.
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.
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.
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.
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.