CONTINUE: start working through book, data types
sudo pacman -Syu
(updates system)sudo pacman -Syu
sudo rm /var/lib/pacman/db.lck
pacman -Syu
pacman -Syu
sudo pacman -S go
go version
git init -b dev
git add .
, git commit -m "initial commit"
git remote add origin git@github.com:edwardtanguay/et034-golang-site.git
git push -u origin dev
package mainimport ("fmt""os")func main() {// Define the file namefileName := "example.txt"// Create or open the file for writing, create it if it doesn't exist, truncate if it doesfile, err := os.Create(fileName)if err != nil {fmt.Println("Error creating file:", err)return}defer file.Close()// Write content to the filecontent := "Hello, this is some text written to the file!"_, err = file.WriteString(content)if err != nil {fmt.Println("Error writing to file:", err)return}fmt.Println("File created and content written successfully.")}
git pull
workedpackage mainimport ("fmt""os")func main() {fileName := "/var/www/go/index.html"file, err := os.Create(fileName)if err != nil {fmt.Println("Error creating file:", err)return}defer file.Close()content := `<html><head><title>Go Site</title><style>body {background-color: #333;color: #ccc;font-family: sans-serif;margin: 1rem;}a {color: #dce378;}</style></head><body><h1>Go Site</h1><p>This file was generated by a Go script.</p><p>Currently learning Go with this free, online book: <a target="_blank" href="https://www.programming-books.io/essential/go/basic-types-2803d5d5229f4932af82a1dcc86eb8bf">Essential Go</a></body></html>`_, err = file.WriteString(content)if err != nil {fmt.Println("Error writing to file:", err)return}fmt.Println("File created and content written successfully.")}