Golang imports tutorial: how to import Golang local package | Golang tutorial



Golang imports tutorial: how to import Golang local package | Golang tutorial

Golang imports tutorial: how to import Golang local package | Golang tutorial

This Golang Imports tutorial is about importing local packages in Golang.
In this video we’ll look at how to import a variable from one Go file to another within a single Golang local package, and how to import a variable declared in another Golang package.
What is a Golang module path? What is a Golang package path?

We’ll look at 2 cases of Golang import local packages:

1. When we need to use a variable declared or defined in another Go file, but within the same directory (that is, within the same Go package)
2. When we need to use a variable that is declared in another Go package.

The most misunderstanding about packages in Golang (and Golang importing issues) are that the Golang local package’s path is not the path of a directory in a file system.
These paths can match, but it’s not necessary.

Follow me @:
Telegram: https://t.me/red_eyed_coder_club
Twitter: https://twitter.com/CoderEyed
Facebook: https://fb.me/redeyedcoderclub

Timecodes:

00:00 – start
00:34 – creating a new Golang project
00:50 – Golang module path
01:40 – Golang “Hello world”
02:12 – Case 1. How to import from a Go file in the same directory
03:13 – Golang local packages – all files in the same directory must have the same package name
03:42 – How to use a variable declared or defined in another Go file (within the same package)
04:40 – Case 2. Import variable from another Golang local package
06:42 – Golang package’s path is a “virtual path”, that might no match to a path of directory in your file system.

*** Golang Tutorials ***

Golang imports tutorial: how to import Golang local package
https://youtu.be/Nv8J_Ruc280

Golang tutorial: How to scrape websites with Golang & Goquery
https://youtu.be/4VIoT50mzzo

Golang Tutorial: How to scrape Ebay with Golang and Goquery
https://youtu.be/mS74M-rnc90

Golang Fyne: How to compile *apk for Android
https://youtu.be/4S-AQlV1pcw

➥➥➥ SUBSCRIBE FOR MORE VIDEOS ➥➥➥
Red Eyed Coder Club is the best place to learn Python programming and Django:
Subscribe ⇢ https://www.youtube.com/channel/UCh_LSaTv2GeZ3woJNTGihew?sub_confirmation=1

Golang imports tutorial: how to import Golang package | Golang casts
https://youtu.be/Nv8J_Ruc280

This Go programming tutorial is about go packages, about Golang import local package system (what are go packages and go modules) , is about how to import Golang variables, about golang modules and packages.

#golang #redeyedcoderclub #goimports #importingingo #gopackages #golanglocalpackage #golangpackages

Comments are closed.