projects/

directory
v0.0.0-...-bc07058 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: Apache-2.0

README

cd ..../go-testy/genai
go get gopl.io/ch1/helloword
$GOPATH/bin/helloworld

Odd, it says needs golang 1.5 but latest is 1.22 and I have that installed.

go run helloworld.go

Workspace

The setenv.sh will set the gopath to the root of this folder. It makes a workspace. Each project, or separate program needs to be in a subdir of this workspace.

setup

After this all the go build and go run code will work.

do this once
$ go mod init myhellorld
do this afterwards or each time the imports changes
$ go mod tidy
do this to build
$ go build myhelloworld
```
This makes a file named myhelloword which can be run.  


## install goimports 

goimports manages the insertion and removaol of import declarations as needed. Its not part of the
standard distribution.





#### GOPATH VS GOROOT
In Go programming language, both GOPATH and GOROOT are environment variables used to define important paths for the Go toolchain and development workflow, but they serve different purposes:

1. **GOPATH**:
   - GOPATH is an environment variable that specifies the root of your workspace. It tells Go where to look for your Go code and where to place compiled binaries.
   - Inside the GOPATH, there are three main directories: `src`, `bin`, and `pkg`. The `src` directory is where your Go source code resides, `bin` is where compiled binaries are stored after you run `go install`, and `pkg` contains package objects.
   - You can have multiple workspaces by setting different GOPATH values.

2. **GOROOT**:
   - GOROOT is an environment variable that points to the location where Go is installed on your system. It is set during the installation of the Go programming language.
   - GOROOT tells the Go toolchain where to find system-wide Go-related files, such as standard libraries, compiler tools, and other essential components.
   - It's generally recommended not to modify GOROOT after installation unless you are updating or reinstalling Go.

In summary, GOPATH is where your own Go projects reside, while GOROOT points to the Go installation directory, including the standard library and Go tools.


# URLS

* [code settings](https://github.com/golang/vscode-go/blob/master/docs/settings.md)
* [golang book online](https://www.informit.com/articles/article.aspx?p=2453564&seqNum=4)


Directories

Path Synopsis
ch2
args command
Echo4 prints its command-line arguments.
Echo4 prints its command-line arguments.
imports command
names command
various temp utils
various temp utils
package_files/tempconv/tempconv
Package tempconv performs Celsius and Fahrenheit conversions.
Package tempconv performs Celsius and Fahrenheit conversions.
package_files/tempconv_ex2.1/tempconv
Package tempconv performs Celsius and Fahrenheit conversions.
Package tempconv performs Celsius and Fahrenheit conversions.
ch3
finds dupelines ch 1.3 dupelines prints the text of each line that appears more than once in the standard input, preceded by its count.
finds dupelines ch 1.3 dupelines prints the text of each line that appears more than once in the standard input, preceded by its count.
Lissajous generates GIF animations of random Lissajous figures ch 1.4
Lissajous generates GIF animations of random Lissajous figures ch 1.4
finds dupelines in files rather than stdin ch 1.3 dupelines prints the text of each line that appears more than once in a file, preceded by its count.
finds dupelines in files rather than stdin ch 1.3 dupelines prints the text of each line that appears more than once in a file, preceded by its count.
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
This file is part of the main package
This file is part of the main package
subdir
This file is part of the subdir package
This file is part of the subdir package
prints command line arguments
prints command line arguments
lissajous
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
sd
src/golang/fs1 command
src/golang/ws1 command
src/golang/ws2 command
src/golang/ws3 command
src/golang/ws4 command
src/golang/ws5 command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL