kims (1) [Avatar] Offline
#1
While reading the first 2 chapters, I noticed a few minor mistakes.

Page numbers are the ones that appear on the pages of the PDF file.

On page 21, the first sentence after Figure 2.1, the word "know" should be "known". It should say, "We can use the built-in function new to allocate and zero memory for any known type."

On page 22, in your example of assigning the address of an existing integer variable to a pointer, I would add a line that declares the myInteger variable at the top of the code block. I would do something like:

// Declare an integer variable that will be pointed to.
var myInteger int

// Allocate an integer pointer and assign the pointer
// to an existing integer variable.
var myIntPointer *int = &myInteger

...

On page 23, second paragraph, second sentence, you say that converting a 64 bit integer to a 32 bit integer truncates the eight high order bytes. You should say that it truncates the four high order bytes. It should say, "The conversion of the 64 bit integer value into a 32 bit integer value will cause the four high order bytes of the 64 bit integer value to be truncated."

On page 23, the last paragraph, you appear to be confusing 4-bit nibbles with 8-bit bytes. This also appears to be the same problem in the previous item I pointed out. If you want to stick to the word "bytes", the last paragraph should be:

We can see that after the conversion and assignment operation, the bit pattern
of both variables are identical within the four low order bytes of the 64 bit integer
variable. Go allows the conversion and assignment operation because of the type
information. Go takes the first 4 bytes of the 64 bit integer variable and writes them
to the 4 bytes of memory assigned to the 32 bit variable. This is safe and maintains
like types during the assignment operation.

On page 23, I would recommend putting an extra space between the bytes when you are showing the memory layout. I would do something like:

myInt64 = 12345678912345678

High Order Bytes
0000 0000 0010 1011 1101 1100 0101 0100

When I preview this message, it looks like the extra spaces I put in are being removed. The intent is to have 2 groups of 4 bits with a single space between them. And then, to have 2 or 3 spaces before the next 2 groups of 4 bits.

On page 25, last sentence, you have the word "user-define" when you wanted "user-defined". It should say, "Let's define a package that contains a user-defined type and an exported function that can be used to create objects of this type:".
erikstmartin (6) [Avatar] Offline
#2
Re: A few mistakes in chapter 2
Thanks for the feedback! We'll go ahead and make these corrections.
Bill Kennedy (69) [Avatar] Offline
#3
Re: A few mistakes in chapter 2
Thanks for the edits, all done.
Bill Kennedy (69) [Avatar] Offline
#4
Re: A few mistakes in chapter 2
Actually using eight bytes was correct. The diagram I provided was confusion. Going to fix that. Please send me your email address and I will have you review.
Kluyg (7) [Avatar] Offline
#5
Re: A few mistakes in chapter 2
Hi! Most of mistakes I've found were already pointed here on the forum, except for this one:
On page 42:
"The Go standard library contains a package called error"
The package is called errors, not error.
fredrik (1) [Avatar] Offline
#6
Re: A few mistakes in chapter 2
On page 34 (section 2.3.2), describing the three sections of the for-statement, you say that the second section is a condition that will terminate the loop when it becomes true (I guess you mean until it becomes false?).
Bill Kennedy (69) [Avatar] Offline
#7
Re: A few mistakes in chapter 2
Thank You
Bill Kennedy (69) [Avatar] Offline
#8
Re: A few mistakes in chapter 2
Oops. Thanks !!