Discover and read the best of Twitter Threads about #GoLang

Most recents (24)

¿A alguien más le parece medio raro cómo de repente apareció el hashtag #TeVieronLasHuevas y se hizo la primera tendencia en un solo día? ¿Como que alguien nos está .. viendo las huevas?

¿Exploremos? #twitterapi #golang #postgres #dataviz
Digamos que queremos descargar la lista completa de tweets con ese hashtag para ver si encontramos algún patrón en los usuarios que lo tuitearon inicialmente. Tal vez muchos de estos usuarios fueron creados más o menos al mismo tiempo. Tal vez comparten más características.
Podemos usar el API de Twitter para hacer la búsqueda y un pequeño programa que descargue algunos datos sobre los tweets y sus autores. Existe una librería para #Golang que lo hace más o menos fácil. github.com/g8rswimmer/go-…
Read 19 tweets
#golang Top Tip — Go lets you express behavioral polymorphism with interfaces, but until generics land, you essentially can't express state polymorphism. So don't try. Seriously. Whatever hacks you have to do with interface{} or reflect or whatever are worse than the disease.
The empty interface{} and package reflect are tools of last resort, for when there's literally no other way to solve your problem. In practice, that means in library code that needs to operate on types that are unknown at compile time.
In application code, by definition, you know the complete set of types you'll ever have to deal with at compile time. So there's almost never a reason to use either of these hacks. You can always write type-specific versions of everything you need. Do that.
Read 3 tweets
Here's a short list of the changes to look forward to for #golang 1.17, to start landing once the merge window opens in a few weeks.

Don't get confused with 1.16, releasing next month. 1.17 will come out in seven months.

Each change with a link, so you can read more.
A register-based calling convention for Go functions. Backwards compatible, and should give 5-10% speed improvements across a range of applications.

github.com/golang/go/issu…
First class fuzzing support in the Go toolchain. This work has been happening behind the scenes in the dev.fuzz branch for some months, so I hope it will start landing for 1.17.

golang.org/s/draft-fuzzin…
Read 8 tweets
GitHub.com/edoardottt/sci… short tutorial. Tread🔽
Basic dns scan:
scilla dns -target target.domain
Dns scan with output as txt:
scilla dns -o txt -target target.domain
Subdomains enumeration:

scilla subdomain -target target.domain
scilla subdomain -w wordlist.txt -target target.domain
scilla subdomain -o txt -target target.domain
scilla subdomain -i 400 -target target.domain (ignore responses with 400 as status code)
Read 15 tweets
Week 2 of analyzing how goroutines pause and resume and how the networking stack and other subsystems interact with the primitives exposed by the runtime.

One of the things I appreciate about C# is how many low level features are directly exposed to users. #golang #dotnet
In golang, it's not possible for you to implement pausing and resuming of goroutines other than by using the primitives go offers, channels, network IO, timers (sleep). This is fine for most applications but comes with additional overhead.
I also learned that go's GC doesn't move pointers and therefore there's no way to pin memory when working with C interop. There's no equivalent to passing around a GCHandle in go, just don't pass things with managed pointers to C.
Read 5 tweets
Welcome to 2021.
--
Whoever is planning to learn #software development in this year, You need to look at these #programming languages.

1. #JavaScript (web)
2. #Python3 (ML, AI, Data Sci)
3. #Java
4. #kotlin (Mobile)
5. #golang (engineering)

#DEVCommunity #CodeNewbies

why👇
Why to learn #JavaScript?
-
Web development is one of the most famous and selling factions of software development and to break through it, you would need to learn JavaScript at all costs.
#websites #webdesigner #webdeveloper #webdevelopers
Why to learn #Python ?
Data Science, #MachineLeraning , #BigData , #ArtificialIntelligence , #DeepLearning , and automation are one of the most trending and highly paying fields.

Now if you are looking for a language that will get you sorted in either of the fields, it's Python.
Read 8 tweets
Christmas present for our music-loving 18mo: his own Sonos music controller made out of a Raspberry Pi 400 and a wood case with handle and velcroed battery pack inside. Printing out 40 color icon stickers for the keys next. Little #golang program reading /dev/input key events.
Zip ties solve all problems. ImageImage
Cutting out these little stickers I'm printing from full sheet sticker paper and removing them from their sticky backing is the hardest part of this project so far. Image
Read 7 tweets
In 2.5 hours: #AdventOfCode live with me in #GoLang. twitch.tv/lizthegrey

Just 10 more puzzles left!
Starting in on #AdventOfCode now!

Honestly hoping for a quick one as I have some job stuff to clean up after, having done errands/paperwork earlier in day, but we'll see what @ericwastl has in store for us! twitch.tv/lizthegrey
Oof. Got tripped up on parsing and then nested data structure mangling. But we got there with the help of the #AdventOfCode community!

Video: (processing may take a while, it's almost an hour...)
Code: github.com/lizthegrey/adv…
Read 4 tweets
Here we go, let's see how the new M1 chips do on Go benchmarks!

(Might be a good time to mute #M1, I have a new toy and I took time off work until the end of the month.)

First step is

$ GOOS=darwin GOARCH=arm64 ./bootstrap.sh

on my corp MacBook.
Well, it couldn't be too easy I suppose.

Ran bootstrap[.]sh (which is just a convenience wrapper for make + mv bin/darwin_arm64/go bin/go + tar), sent it over with webwormhole.io, cleared the quarantine xattr, and...

zsh: killed ./go-darwin-arm64-bootstrap/bin/go

#M1
Frank has it right, after codesigning bin/* and pkg/tool/darwin_arm64/* I got the compiler running.

Still, this needs fixing, it stops "go run" and "go test" from working. I wonder if the dev kits had it disabled.

Read 13 tweets
I'm about to buy a new MacBook Pro 13" with the famous Apple M1 SoC.

Let's see how ready it is for developers.

A thread ⤵️

Legend: 🔴 = not working, 🟢 = working

#AppleSiliconM1
🟢 Rust is working!

`aarch64-apple-darwin` is part of the Tier 2 platforms, doc.rust-lang.org/nightly/rustc/….

See the PR, github.com/rust-lang/rust….

#AppleSiliconM1 #rustlang
🟢 Python is working!

It is part of macOS Big Sur.

#AppleSiliconM1 #python
Read 26 tweets
I always call into a run function from main in #golang passing in any system dependencies as arguments.

If I am going to parse flags, use arguments, and write to stdout, my run func looks like this:

func run(args []string, stdout io.Writer) error

pace.dev/blog/2020/02/1…

1/6
This means I can write normal Go tests that can call the run function, and there's no global state to mess around with.

func Test(t *testing.T) {
args := []string{"tool", "--debug=true", "./testdata"}
var stdout bytes.Buffer
err := run(args, stdout)
//...

2/6
This is nice because I can use any `io.Writer` as the `stdout`. In my tests, I use bytes.Buffer - which allows me to capture (and make assertions about) what the tool outputs.

I can also play around with any flags or arguments without having to do anything weird :)

3/6
Read 6 tweets
A bit more context on how we organise our #golang services at Pace.
Oto has a very simple definition format:

type Service interface {
Method(Request) Response
}

Which turns into:

func (s *Service) Method(context.Context, Request) (*Response, error) {
// todo: implementation
}
The pointer return is simply because I like returning nil in the error case:

return nil, errors.New("not today mate")
Read 8 tweets
The #golang proposal to introduce generic functions and types (via parametric polymorphism) has been evolving nicely. This 🧵 summarizes what the latest is:

- [] sqr brackets to be used for type param
- type param must have a constraint
- constraint `any` will be new keyword Image
Use type constraints to define the set of types that can satisfy type arguments Image
Example: defining and using a generic function Image
Read 7 tweets
✨ Rob Pike's 5 Rules of #programming

#golang #simplicity

🧵👇
1️⃣ You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.
2️⃣ Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.
Read 7 tweets
On @GoTimeFM yesterday, @francesc, @1z0b31, @rakyll, and I were discussing context.Context in #golang

Here's how we made our io.Copy context-aware (and therefore cancellable)

pace.dev/blog/2020/02/0… Image
@francesc I did put the context in a struct look :)

I think it’s ok in this case. 🤫 Image
It could be done with a closure and ‘type ReaderFunc func([]byte) (int, error)’ io.Reader func handler

But what’s the difference really?
Read 3 tweets
Once upon a time I tried to extract "best practices" for TODOs based on what I could find in large #golang codebases. Turns out this mostly matches Google's (only lightly externally documented) practices.
I've heard there's a growing consensus that TODO(bug #) is more useful than TODO(username) given that maintainers and owners move over time.
A static code analyzer for annotated TODO comments:
- ensure all TODOs have bug numbers
- ensure all referenced bugs are still open

github.com/preslavmihaylo…
Read 4 tweets
5 years ago I proposed a #golang fuzz-a-thon in honour of the release of 1.5.

Probably a good time to do it again preparing for 1.15

groups.google.com/forum/#!msg/go…
Come hang out in the #fuzzing channel on the Gophers Slack or ask questions here.
Here's a quick go-fuzz tutorial I wrote:

medium.com/@dgryski/go-fu…

Some defaults in go-fuzz have changed, so once you have your fuzz function you can just run:

go-fuzz-build && go-fuzz

to start finding crashes.
Read 4 tweets
A Friday riddle...

A designer named White, a javascript developer named Black, and a #golang programmer named Red are on a zoom call.

1/2
One of them says, "I have black hair, and you two have red hair and white hair respectively, but none of us has a hair colour that matches our name."

"Oh yeah, that's right." replies the designer.

What's the #golang programmer's hair colour?

2/2
(This riddle was adapted from one in The Chicken from Minsk book)
Read 3 tweets
Stackoverflow Developer Survey 2020 results are out :  insights.stackoverflow.com/survey/2020#mo… 

Picture for #Ruby doesn't look good. For me, it has several signs of becoming exotic / niche (like COBOL) than being widespread (like Java). This has huge impact on hiring and talent pool (1/n)
1. % of survey respondents working on Ruby is : 7.1 Decreasing over the years :
2020 - 7.1 (Rank 14)
2019 - 8.4 (Rank 12)
2018 - 10.1 (Rank 13)
2017 - 9.1 (Rank 10)
2016 - 8.9 (Rank 11)
This by itself is not significant, but when read with other metrics it is meaningful (2/n)
2. #rubyonrails is also facing a similar decline in popularity. This year it was at 7.0%
This, of course, could be the bias associated with the developers surveyed. It still, however, shows where the #developer #community is concentrating. More on importance of this below. (3/n)
Read 13 tweets
Es un orgullo para la Comunidad de Desarrolladores de Argentina poder acompãnar iniciativas como el #ConnectDay junto a estas empresas @plataforma5la, @distillerylatam, @revistasg y @clarikagroup 💪
¡Hoy es el #ConnectDay! Desde CoDeAr estamos felices de poder acompañar a @wtmriodelaplata, @GDGCordobaARG, @gdgriodelaplata en este día de charlas y de compartir conocimiento en comunidad. Podés sumarte a la transmisión en vivo desde acá:
Comienza la primer charla sobre #DataScience y #Economía, en el contexto de las #transdisciplinas.
Read 118 tweets
I am gifting a copy of Go Programming Blueprints: Second edition to FIVE random people. @chadtomkiss has joined me and is donating one too!

Here's the list of names ready for my Go map abuse... play.golang.org/p/4NvVrI8g22P

If you'd like to be added, let me know. Will draw tonight.
Here's the final code, I will run this in 30 minutes unless someone points our any glaring mistakes in it :)

gist.github.com/matryer/361c47…

#golang
Read 3 tweets
#golang tip

You can use documented consts for simple values (like bools) to make code much easier to read and understand AT A GLANCE.

I wouldn't do this _all_ the time, but when I notice code is tricky to read, I do it.

Example follows... 1/4
Consider this:

Greet("Mat", true)

I'd have to look up the method signature to figure out what that 'true' was for.

2/4
If we had these consts:

const (
// AnimationOn will greet with a flourish.
AnimationOn = true

// AnimationOff will greet without animations.
AnimationOff = false
)

Glanceability goes up:

Greet("Mat", AnimationOn)

3/4
Read 5 tweets
1) Are you using #postgres via #docker for mac?

Have you ever noticed `EXPLAIN ANALYZE` slowing down your queries by like 60x?

Let's dig into some #postgres and #linux internals to figure out what's going on! An accessible version of this thread is available at https://github.com/felixge/tweets/tree/master/postgres-docker-explain-analyze
1b) This thread is also available on GitHub: github.com/felixge/tweets…
2) First we need some understanding of how `EXPLAIN ANALYZE` works.

Looking through the PostgreSQL code, it basically boils down to:

start = clock_gettime()
row = node.nextRow()
node.time += clock_gettime() - start
return row
Read 22 tweets
Hey all. I have a project called DATASUS that is supposed to help researchers all around the world having access to the Brazilian Healthcare public data sets. The problem is that their FTP blocks access from IPs outside Brazil. #datasus
github.com/danicat/datasus
The project is dead until I find a scalable solution for that that isn't saying "buy a VPN" for everyone interested on it (it is what I have been doing). I've halted all the developments on this project because of this issue and it has been a long time.
I want to expand it and port it to #python and #golang, for instance. But there is no point in doing that until the problem above is fixed.
Read 6 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!