|
Filip Wojciechowski
@
filipcodes
Warsaw, Poland
|
|
Project based. Impressionable. Coding (JavaScript/TypeScript, Go). Books.
|
|
|
96
Tweetovi
|
188
Pratim
|
29
Osobe koje vas prate
|
| Tweetovi |
|
Filip Wojciechowski
@filipcodes
|
19 h |
|
Agree, telling a coherent story with the tests is more important that coming up with a definition of a "unit". In the case of the package in question to tell a story with the tests I also needed to refactor the implementation -- the result is much more readable code.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
3. velj |
|
Thank you! This approach makes sense to me -- I'm learning Go on my own with few people to debate on topics like this one so feedback like this is most useful.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
3. velj |
|
Thank you! It's already an internal (sub-)package. It makes a series of API calls to 4 endpoints, collects a bunch of interrelated raw data, processes that data and then returns the result expressed in terms of domain types.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
3. velj |
|
Question. @davecheney says the unit of testing in #golang is a package. What about packages with one public method that does a lot of work behind the scenes. Do you test the public api of the package (effectively doing an integration test) or unit test the private helper methods?
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
3. velj |
|
Agreed. Also, if a given programming language has very powerful meta-programming abilities (like Haskell) this advice is difficult to implement since what qualifies as valid syntax can be fluid. Still, a good general rule, in my opinion.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
3. velj |
|
My experience with #golang taught me this: if your #programming language has a popular code formatting tool - use it, and use it *with the default settings*. The benefits of a single code formatting standard trump any subjective aesthetic preference in that regard.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
29. sij |
|
A super simple testrunner for #golang. Just run it in the root of a Go project and it will automatically run tests for a package when one of the ".go" files in that package has been modified.
Yeah, I know, no tests (yet)... 🤷
github.com/fwojciec/testr…
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
25. sij |
|
Gatsby or Next.js. Happy to say more about each option if you're interested/have specific questions.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
20. sij |
|
Part 2 of my series about building #GraphQL servers in #golang. This post is all about dataloaders.
w11i.me/graphql-server…
|
||
|
|
||
| Filip Wojciechowski proslijedio/la je tweet | ||
|
✕✕✕✕✕
@peterbourgon
|
5. ruj |
|
#golang Top Tip: the first line of every unit test should be t.Parallel(). If that doesn't work in your package, fixing it will uncover and resolve a lot of design errors.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
16. sij |
|
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
16. sij |
|
If you're comfortable with JS/React ecosystem Gatsby is arguably more powerful, especially if you need SPA-like features. For what it's worth, I love writing Go, bit my blog is in Gatsby/TypeScript.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
14. sij |
|
My solution is GraphQL using gqlgen on the server, database stuff using sqlc and then react+Apollo on the frontend. You can generate types automatically on the frontend from the server GraphQL schema.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
14. sij |
|
Cool idea, thanks!
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
14. sij |
|
I started using optional *Config structs in #golang constructor functions. When config is nil the default values are used; a defined config enables customization of the instance (to pass a mocked dependency for testing, etc.). Are there other good approaches to achieve this? pic.twitter.com/bval2BOfJu
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
11. sij |
|
Walter Isaacson, The Innovators. A somewhat broader scope than your question. Written with a general reader in mind, but I've enjoyed it.
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
8. sij |
|
I would use Erlang/Elixir over Go for web development of not for the lack of strong typing. Go is in a class is is own, though, when it comes to cli tools, in my opinion.
|
||
|
|
||
| Filip Wojciechowski proslijedio/la je tweet | ||
|
Golang Warsaw Meetup
@golangwaw
|
7. sij |
|
Join the first 2020 Golang Warsaw meetup on 15.01. We have two talks on Go developement in the CloudNative environment, unique Golang-10th-anniversary pins for attendees, and JetBrains licenses for good questions.
Looking forward to seeing you all! meetup.com/Golang-Warsaw/… pic.twitter.com/888Y7sEvVk
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
6. sij |
|
My recent discovery that has replaced sqlx in my projects -- maybe an idea for your next weekend? :) github.com/kyleconroy/sqlc
|
||
|
|
||
|
Filip Wojciechowski
@filipcodes
|
5. sij |
|
I just published Let’s Build a #GraphQL Server: Part 1 in #golang on Medium: link.medium.com/sDEm0inYZ2
|
||
|
|
||