Go programming language discussion

!golang

@lemmy.ml
Create post
VSCode: Debugging Attached Process does not work

VSCode: Debugging Attached Process does not work

I made some Go scripts that require user input fmt.Scanln(&fileName) during the execution. When I use the Go debugger built into VSCode which is the launch type, it works but there is no way to enter any prompts when your exeuctable asks for a input. With other programming languages like NodeJS and PHP, there is way to run the scripts in "debugging mode" where it will run the code but before it executes the code, it will wait to attach to a debugger on your system and then execute the code. This has always allowed me to use the terminal for inputs in the executable.

For example to do this in NodeJS, you will use node --inspect-brk=0.0.0.0 main.js instead of node main.js and then run the debugger in VSCode to attach it to the executing script. Is there a way to do this with Go? Do I need to set something up to achieve this?

I am on Linux Mint and cannot find any commands to run go run . but to wait for a debugger to attach to the executable before executing.

[ANN] peertube: a (simple) Go client for PeerTube

[ANN] peertube: a (simple) Go client for PeerTube

Open link in next tab

peertube: A simple and incomplete Peertube client

https://sr.ht/~sbinet/peertube

Go 1.22.1 released
Open link in next tab

Release History - The Go Programming Language

https://go.dev/doc/devel/release#go1.22.1

Release History - The Go Programming Language
The Impact of Pre-allocating Slice Memory on Performance in Golang

The Impact of Pre-allocating Slice Memory on Performance in Golang

Open link in next tab

The Impact of Pre-allocating Slice Memory on Performance in Golang | Oilbeater's Study Room

https://oilbeater.com/en/2024/03/04/golang-slice-performance/

Is directory monitoring just cursed?

Is directory monitoring just cursed?

So, I need to monitor a fairly large nested directory tree for changes on Linux. It seems like there are a few different watcher modules that I could use -- fsnotify and notify being the main ones, both of which use the inotify interface and attempt to set watches on each individual subdirectory and maintain all their watchers as things change. I have way too many directories for that to be a workable approach. It looks like the underlying issue is just that this is a difficult problem on Linux; both inotify and fanotify have some issues which make them difficult for library authors to use to present a clean and useful API.

Long story short - I coded up an fanotify-based solution which seems like a good start of what I need, and I'm planning on sharing it back in the hopes that it's useful. I guess my question is, did I miss something? Is there already an easy and straightforward way to monitor a big directory for changes?

Cool http service article I found

Cool http service article I found

Open link in next tab

How I write HTTP services in Go after 13 years | Grafana Labs

https://grafana.com/blog/2024/02/09/how-i-write-http-services-in-go-after-13-years/

Mat Ryer, principal engineer at Grafana Labs and host of the Go Time podcast, shares what he's learned from more than a dozen years of writing HTTP services in Go.

How I write HTTP services in Go after 13 years | Grafana Labs
Golang Co-Creator Rob Pike: 'What Go Got Right and Wrong'

Golang Co-Creator Rob Pike: 'What Go Got Right and Wrong'

Open link in next tab

Golang Co-Creator Rob Pike: 'What Go Got Right and Wrong'

https://thenewstack.io/golang-co-creator-rob-pike-what-go-got-right-and-wrong/

An excellent standard library and packaging system, first-class concurrency support and a focus on readability are among the traits that keep Golang devs happy.

Golang Co-Creator Rob Pike: 'What Go Got Right and Wrong'
Routing Enhancements for Go 1.22

Routing Enhancements for Go 1.22

Open link in next tab

Routing Enhancements for Go 1.22 - The Go Programming Language

https://go.dev/blog/routing-enhancements

Go 1.22's additions to patterns for HTTP routes.

Routing Enhancements for Go 1.22 - The Go Programming Language
GopherConAU 2023 video track

GopherConAU 2023 video track

Open link in next tab

https://invidious.fdn.fr/playlist?list=PLN_36A3Rw5hFsJqqs7olOAxxU-WJGlXS0

Interfaces Are Not Meant for That

Interfaces Are Not Meant for That

Open link in next tab

Interfaces Are Not Meant for That

https://preslav.me/2023/12/15/golang-interfaces-are-not-meant-for-that/

It's time to ask ourselves how much abstraction in our Go code really makes sense.

Interfaces Are Not Meant for That