l3x / learn-fp-go

Learning Functional Programming in Go
97 stars 53 forks source link

Errata page 1 #1

Closed dlgoodchild closed 6 years ago

dlgoodchild commented 6 years ago

Hi,

I started reading this book via the Mapt (Packtpub) service. Barely through the first page and there's quite a number of issues.

Just letting you know that the path mentioned for "To set your GOPATH, visit: https://github.com/golang/go/wiki/Setting-GOPATH" is wrong, there's no hyphen after Setting.

The screenshots, links and text reference the repo (this repo) as l3x/fp-go.git, whereas it's actually l3x/learn-fp-go.git.

The screenshot associated to "go run cars.go", shows that one should go run cars.go in the following path: ~/myprojects/fp-go/1-functional-fundamentals/ch01-pure-fp/01_oop.
There is no cars.go in that path, it's actually in ~/myprojects/fp-go/1-functional-fundamentals/ch01-pure-fp/01_oop/src/oop. And even when you do run go run cars.go from that directory, you get:

go run: cannot run non-main package

So cd back up to 01_oop and instead go run main.go works correctly as illustrated in the screenshot (provided you adjust your GOPATH to pwd).

For those less experienced, that's a considerable amount of errata for being essentially page 1.

dlgoodchild commented 6 years ago

Is this the best place to notify of mistakes in the book?

l3x commented 6 years ago

Hey Dave,

Yes! this is a great place to put coding issues. Thank you!

I will put updated/corrected content for each chapter, in order, here: http://lexsheehan.blogspot.com/2017/11/corrections-for-learning-fp-in-go-book.html

@dlgoodchild I just updated that corrections page with your input. Thank you!!

Lex

dlgoodchild commented 6 years ago

OK great. I'll keep you posted if I find others. I'll close this particular issue then, as it references page 1 specifically.

dlgoodchild commented 6 years ago

Actually not much further on it references 01_fib, but actually it's 02_fib in this repo. I'm letting you know because you can technically fix these in the repo (whereas you can't change a printed book). Actually too, if you renamed the repo to fp-go there would be greater alignment with the book content.

dlgoodchild commented 6 years ago

Actually, not sure what to suggest now. The text references 01_fib and the screenshot references 02_fib.

These are fairly minor I know, but thought I'd share them anyway.

dlgoodchild commented 6 years ago

Still in chapter 1:

Since ourfibTests structure has been defined in another test in our package, in chapter1/_01_fib/ext1_test.go, we don't need to define it again.

There is no dir chapter1, it's ch01-pure-fp? and the subdir is 02_fib, and not _01_fib (this makes now, 3 variations). There's definitely no file named ext1_test.go anywhere in any directory, and the fibTests is actually FibTests defined in simple_test.go

dlgoodchild commented 6 years ago

Contents of main.go in 05_sum, assuming you probably didn't mean to have this? as it doesn't import any of the src/ nor execute anything related.

package main

import (
////////////////////////////////////////////////    "mypackage"
)

func main() {
    println("hello from main.go")
////////////////////////////////////////////////    println(mypackage.MyName() + " says hi from mypackage")
}