23. Go - Creating Packages

1. Create folder "PACKAGENAME"


2. Create go file

package PACKAGENAME

import "fmt"

func printname(a string) {
    fmt.Println(a)
}


3. Make linkable object file

go install


4. Import into another go as a package

package main

import m "UserData\VSCode\Go\test"

func main() {
    m.printname("hello")
}



Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort