10. Remote Packages

circle-exclamation

Assignment

1

Create a new directory in the same parent directory as hellogo and mystrings called datetest.

2

Create main.go in datetest and add the following code:

package main

import (
	"fmt"
	"time"

	tinytime "github.com/wagslane/go-tinytime"
)

func main() {
	tt := tinytime.New(1585750374)
	tt = tt.Add(time.Hour * 48)
	fmt.Println("1585750374 converted to a tinytime is:", tt)
}
3

Initialize a module:

go mod init {REMOTE}/{USERNAME}/datetest
4

Download and install the remote go-tinytimearrow-up-right package using go get:

go get github.com/wagslane/go-tinytime
5

Print the contents of your go.mod file to see the changes:

cat go.mod
6

Compile and run your program:

go build
./datetest

Run and submit the CLI tests from the root of the datetest package.