Files
bootdotdev-fcc-learn-golang…/course/12-local_development/exercises/12-custom_package/readme.md
wagslane 9be3074de6 first
2023-05-01 15:25:27 -06:00

635 B

Custom Package Continued

Let's use our new mystrings package in hellogo

Modify hellogo's main.go file:

package main

import (
	"fmt"

	"{REMOTE}/{USERNAME}/mystrings"
)

func main() {
	fmt.Println(mystrings.Reverse("hello world"))
}

Don't forget to replace {REMOTE} and {USERNAME} with the values you used before. Then edit hellogo's go.mod file to contain the following:

module example.com/username/hellogo

go 1.20

replace example.com/username/mystrings v0.0.0 => ../mystrings

require (
	example.com/username/mystrings v0.0.0
)

Now build and run the new program:

go build
./hellogo