ardanlabs / gotraining Goto Github PK
View Code? Open in Web Editor NEWGo Training Class Material :
Home Page: http://www.ArdanLabs.com
License: Other
Go Training Class Material :
Home Page: http://www.ArdanLabs.com
License: Other
go version: Go 1.19
compilation error: entity.ID undefined (type T has no field or method ID)
Hi, I am taking your course from O'Rielly, We are developing Event based Microservices Architecture using Golang,
Any suggestion for Architecture Example With Golang(Micro-services)+Kafka?
Let's get rid of all usages of println
and use the fmt
versions. I have students copying and pasting from the examples that use it.
Are there any reasons to keep it in any examples? Like in the escape analysis code or something?
I was trying to use gorename
from VSCode the other day, but was blocked by some code in my GOPATH
that turned out to be in the gotraining
repo. Now, I updated the repo and the problem went away, but even after updating it appears there are still some compile and lint issues that you may want to take care of:
% golint ./...
2017/09/04 10:00:32 topics/go/language/methods/example5/example5.go:4:1: expected 'package', found 'import' (and 1 more errors)
main.go:17:5: exported var Render should have comment or be unexported
topics/go/concurrency/channels/example5/example5.go:18:7: var timeoutSeconds is of type time.Duration; don't use unit-specific suffix "Seconds"
topics/go/design/composition/exercises/template1/template1.go:109:6: expected operand, found '{' (and 1 more errors)
topics/go/design/error_handling/example1/example1.go:24:1: comment on exported function New should be of the form "New ..."
topics/go/design/error_handling/example1/example1.go:26:23: exported func New returns unexported type main.error, which can be annoying to use
topics/go/language/exporting/example3/counters/counters.go:12:21: exported func New returns unexported type counters.alertCounter, which can be annoying to use
topics/go/packages/context/exercises/template1/template1.go:71:3: expected '}', found 'return' (and 1 more errors)
The instructions in the comments of the template:
are slightly different than in the exercise's instructions:
https://github.com/ardanlabs/gotraining/tree/master/topics/interfaces
I very much liked "Get Programming with Go"; but I found "Head First Go" (O'Reilly) even better; maybe you add it to the list?
maybe this complicates things but i think slice.Max()
and slice.Min()
should return an error.
there is no good way to return a value that is out of band (like -1 nor is there a NaN
like with floats).
so the best way to signal an error like a nil
or empty slice is via an error value.
the result is that if you pass a nil
or empty slice, we immediately access an element in our slice that is out of bounds when we prime our max
value.
also, i feel like the functions have a more general path -- instead having to check if the supplied slice has only 1 element, we can check if we're working on our first iteration in the inner loop by having range return the index.
What's the best way to contribute to this repo?
Are contributions welcome?
Hardcore is a word associated with porn; although I'm sure it attracts some people, it alienates others. A new name might convey the rigor and thoroughness of the program, and also avoid images of violence and misogyny.
If the organizers and community are happy with the name, I'll close this issue. But I know people in the community who would like to create a more inclusive culture, and this could be a good step in that direction.
When dep
was last ran against the project, it pulled in v1.1.0
of github.com/theplant/blackfriday
which is broken (bad import for unicode/utf8
). We should tweak the Gopkg.toml file to pull a good version, and then re-run dep
.
The Video from the main page - "GopherChina (2018) - Composition In Go William" is private ( unaccessible )
In gotraining/topics/README.md the following link is broken:
Go Challenges
Learn Go by solving problems and getting feedback from Go experts!
import (
"github.com/ardanlabs/gotraining/13-http/api/app"
)
As the folder becomes http, the number prefix "13-" has to be removed, and all other imports as well.
Inner type promotion from the lecture 4.3 - Embedding , example https://go.dev/play/p/mbuA2SDiHKV?v=goprev
is not working as intended
./prog.go:43:4: ad.notify undefined (type admin has no field or method notify)
Go build failed.
Hi the link in this page https://github.com/ardanlabs/gotraining/blob/master/topics/api/composition/README.md for design guidelines results in a 404.
@ardan-bkennedy when I discuss decoupling and go through the whole Xenia -> Pillar exercise I find myself stumbling on the name "Pillar" because it sounds so similar to the interface "Puller". I think this also creates some "who's on first" kind of confusion for the students as well. Let's rename it.
The link to Pikes 5 rules in reading/README.md
should be https://users.ece.utexas.edu/~adnan/pike.html
Hi , according to ur blog , i write a test :
`
startingTime := time.Now().UTC()
time.Sleep( 1000 * time.Nanosecond )
endingTime := time.Now().UTC()
var duration time.Duration = endingTime.Sub( startingTime )
fmt.Printf( "%d \n", duration.Microseconds() )
`
the result is 1000
In the post - https://www.ardanlabs.com/blog/2023/08/golang-slices-clip-clone-compact.html
Figure 3 shows that after list = slices.Clip(list)
new list
slice has a different underlying array with size 1.
But according to this code this is wrong:
package main
import (
"fmt"
)
func main() {
var arr [10000]int
fmt.Println("arr", &arr[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(arr), cap(arr))
slArr := arr[:]
fmt.Println("slArr", &slArr[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(slArr), cap(slArr))
slArr = arr[:1:10]
fmt.Println("slArr", &slArr[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(slArr), cap(slArr))
sl := make([]int, 1, 10000)
fmt.Println("sl", &sl[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(sl), cap(sl))
sl = sl[:]
fmt.Println("sl", &sl[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(sl), cap(sl))
sl = sl[:1:10]
fmt.Println("sl", &sl[0])
fmt.Printf("Len(%d), Cap(%d)\n", len(sl), cap(sl))
}
Notice, address of &slArr[0]
or &sl[0]
doesn't change after changing the capacity.
Or did I understand smth wrong?
Hi there!
I want to ask about some inconsistency. There are two loggers in "patterns" section ( topics/go/concurrency/patterns ):
The only difference between their main.go files is using custom/stdlib logger, but "advanced logger" has empty package logger (https://github.com/ardanlabs/gotraining/blob/master/topics/go/concurrency/patterns/advanced/logger/logger.go) - https://www.diffchecker.com/5vcK6nKY
It seems "advanced/logger" isn't used.
Is it a valid package?
Thank you!
gotraining/blob/master/02-array_slices_maps/03-maps/example3/example3.go
number 26 has a error
The front page assumes attenders are using either Windows or OSX, I have been finding an increasing number of Ubuntu, and Linux generally, users on workshops. Often these people can trivially install using packaging. Sadly though sometimes this leads to using an old version of Go. I suspect similar situation ofr the BSD users. It would be good to give these people sensible installation instructions on a par with Windows and OSX users.
The simulations under gotraining/topics/go/algorithms/simulations/
use rand
with a fixed seed. Using a fixed seed will produce the same output on every run.
A better way would be to use a non-fixed seed:
var r = rand.New(rand.NewSource(time.Now().UnixNano()))
day := r.Intn(daysInYear)
@ardan-bkennedy, thank you for this amazing course and repository organization.
During decoupling and in interface pollution topic, you have fixed the pollution, but the New
function is sharing the concrete value of the type up the call stack.
composition/README.md#L63 - Playground Example
I know this is a very popular design, but I can't understand why do we need to allocate memory here and share the value instead of returning a copy of the value?
Do we prefer that the caller will have easier access to methods with pointer receiver if we share the value up the call stack over memory allocation and the risk of memory leak?
https://github.com/ardanlabs/gotraining/tree/master/topics/go#readability
Example Readability Issue: (https://cpp.sh/6i7d)
Sorry, /6i7d is no longer a valid url.
Short URLs have been disabled due to spam. You can now create (longer) links to your code using the "Link to this code" feature.
During some time, your code may still be reachable at http://th.cpp.sh/6i7d
I tried to use the Gopher Slack invite link https://gophersinvite.herokuapp.com/ in the README and got an error that the invite has expired.
Hi @ardan-bkennedy,
why you pass the complete
var into processor
function when actually complete
is a global variable that processor
function can access it directly without passing it as an argument to it.
I'm currently joining your course Ultimate Go Programming on safaribooksonline, and I don't know where is the right place to ask you a question so I land it here.
Hi there.
Just want to let you know, that redirect from https://www.goinggo.net doesn't work ( report http://r.h-t.co/en/3/6a52a920-cdd6-e811-8605-0003ff7328cc )
For example https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html from Opening.md
But at the same time, http://www.goinggo.net works correctly ( as well as redirect to https://www.ardanlabs.com )
I've just sent a PR where found and replaced all www.goinggo.net -> www.ardanlabs.com/blog PR#277
Nevertheless, I suppose there might be links pointed to the previous domain.
Thank you!
UPD
http://www.goinggo.net/2016/05/installing-go-and-your-workspace.html
redirects to https://www.ardanlabs.com/2016/05/installing-go-and-your-workspace.html
( without blog
in the path )
Hi everyone I just had a blast watching the introduction video of William on this link:
http://www.informit.com/store/ultimate-go-programming-livelessons-9780134757483
I think that someone should make a remix of this video adding some dirty rap beat while William is talking about his course. This would become a major hit.
I can't stop laughing at this!
Have a nice day!
https://github.com/ardanlabs/gotraining/blame/master/topics/go/language/interfaces/README.md#L30
I think the article is moved here: https://rakyll.org/interface-pollution/
a clearer name for the generic print function is printGeneric
@ardan-bkennedy I want to take the existing map examples, break them apart, and reorder the content. I get the feeling that when this material was written it was assumed that the student was already familiar with maps and we are just covering them to nail down some of the "gotchas" as well as the best practices. Consider that the first example right off the bat is jumping into iterating over a map and how it is in an undefined order. If you are just learning maps this is a confusing place to start.
Here is how I want to teach the materials at least for Go Fundamentals. Do you think this would work with Ultimate? It's still basically the same content (though I expand the coverage of zero value for non-present keys)
Start with the basics.
users := make(map[string]user)
users["Roy"] = user{"Rob", "Roy"}
roy := users["Roy"]
delete(users["Roy"])
We just talked about delete so it seems natural to move on to this.
u := users["Roy"]
u, found := users["Roy"]
scores["anna"]++
without checking for existence.This could be last after the range stuff? It just needs to be covered before we're done.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.