Go programming language discussion
- 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 ofnode 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
hi there,
just a quick message to announce my latest small pet project of the week :
- https://sr.ht/~sbinet/peertube
A simple (and incomplete) Go client for PeerTube[1] (an alternative to Big Tech's video platforms).
Right now, the client can:
- authenticate with a PeerTube server,
- list accounts,
- list videos for a given account,
- upload videos for a given account,
- remove videos for a given accounts.
There's also a simple peertube-cli command-line program to perform the things above:
```sh $> go install git.sr.ht/~sbinet/peertube/cmd/peertube-cli $> peertube-cli help peertube-cli - runs peertube-cli commands and sub-commands
Commands:
auth-add authenticate with a PeerTube server auth-ls list the known PeerTube servers auth-rm remove a PeerTube login video-ls list video(s) from a PeerTube server video-upload upload a video to a PeerTube server
Use "peertube-cli help <command>" for more information about a command. ```
It's not much, but it allowed me to ease the day-to-day work of uploading audio files for a podcast I am maintaining and authoring.
hth, -s
[1]: https://joinpeertube.org/
- 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 foundgrafana.com How I write HTTP services in Go after 13 years | Grafana Labs
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.
- Golang Co-Creator Rob Pike: 'What Go Got Right and Wrong'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.
> 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.
Though this was from some time ago, I'd like to share it here and have a light discussion. Rob did an awesome talk, and I agree with him at almost every point.
I do hardly disagree with him on the gopher license attribution. I do heavily attribute gopher's image to Renee French, but I'm not the creator, so whatever.
- Routing Enhancements for Go 1.22go.dev Routing Enhancements for Go 1.22 - The Go Programming Language
Go 1.22's additions to patterns for HTTP routes.
- Arctic Warfare is now available (powered by Ebitengine)
Arctic Warfare is now available to play. Battle tanks in the arctic, demolish trees and annihilate snowmen. View the source code here.
- etk - Ebitengine tool kit for creating graphical user interfaces
etk is a library for the Ebitengine game engine that simplifies creating graphical user interfaces. The README lists the features and widgets. Boxcars uses etk to greatly simplify UI development, as its single codebase targets web, desktop and Android.
- GopherConAU 2023 video track
Here is the full playlist from the GopherConAU 2023 conference:
- https://invidious.fdn.fr/playlist?list=PLN_36A3Rw5hFsJqqs7olOAxxU-WJGlXS0
- Interfaces Are Not Meant for Thatpreslav.me Interfaces Are Not Meant for That
It's time to ask ourselves how much abstraction in our Go code really makes sense.
- Finding unreachable functions with deadcode / Alan Donovango.dev Finding unreachable functions with deadcode - The Go Programming Language
deadcode is a new command to help identify functions that cannot be called.
- Design of the tabula backgammon engine
tabula is a backgammon engine I recently created.
The engine builds on principles described by the author of the Motif engine here: https://bkgm.com/motif/engine.html
You can play against the engine right now at https://bgammon.org
- What's running on you CI/CD ?
After a while of absence, I'm getting back into Go programming and I was wondering: What's new in terms of quality control tooling? What are you running on your CI/CD ? Any suggestions?
- Announcing doubling cube support at bgammon.org (Go & Ebitengine)
bgammon.org is a free online multiplayer backgammon service without any ads.
Source code: https://code.rocket9labs.com/tslocum/bgammon
- Fixing For Loops in Go 1.22 - The Go Programming Languagego.dev Fixing For Loops in Go 1.22 - The Go Programming Language
Go 1.21 shipped a preview of a change in Go 1.22 to make for loops less error-prone.
- WASI support in Go - The Go Bloggo.dev WASI support in Go - The Go Programming Language
Go 1.21 adds a new port targeting the WASI preview 1 syscall API
Go 1.21 adds a new port targeting the WASI preview 1 syscall API through the new GOOS value wasip1. This port builds on the existing WebAssembly port introduced in Go 1.11.
- Writing an OS in Go: The Bootloader
How you could write an operating system with pure Go code (including no CGO!)
- netris – Terminal-based multiplayer Tetris clone
Also available via SSH:
ssh playnetris.com
Source code:
https://code.rocket9labs.com/tslocum/netris
- Experimenting with project templatesgo.dev Experimenting with project templates - The Go Programming Language
Announcing golang.org/x/tools/cmd/gonew, an experimental tool for starting new Go projects from predefined templates
- Structured Logging with sloggo.dev Structured Logging with slog - The Go Programming Language
The Go 1.21 standard library includes a new structured logging package, log/slog.
- proposal: review meeting minutes [2023-08-02]github.com proposal: review meeting minutes · Issue #33502 · golang/go
The proposal review group meets regularly (roughly weekly) to review pending proposal issues and move them along in the proposal process. Review consists primarily of checking that discussion is on...
Your weekly appointment with the latest news about accepted/declined proposals.
- https://github.com/golang/go/issues/33502#issuecomment-1662728074
- Preview: ranging over functions in Go
A major Go language change proposal was published earlier this week: add range over int, range over func, and there's a good chance this change will make it into a future Go release. In this post I will discuss the motivation for this proposal, how it's going to work, and provide some examples of how Go code using it would look.
- Go 1.22 inlining overhauldocs.google.com Go 1.22 inlining overhaul
Go 1.22 inlining overhaul , with contributions from , , , and Last update: The Go compiler’s inliner has never been particularly good. It wasn’t until Go 1.12, released in 2019, that the Go compiler supported inlining more than leaf functions, and we’ve slowly chipped away at more limita...
The Go compiler’s inliner has never been particularly good. It wasn’t until Go 1.12, released in 2019, that the Go compiler supported inlining more than leaf functions, and we’ve slowly chipped away at more limitations of the inliner over the years (it started inlining functions with for loops in early 2021!). Go 1.20, released in February 2023, added support for basic profile-guided inlining, the most significant change to Go’s inlining policy since 1.12.
[...]
The rest of this document lays out a set of considerations for a redesign of Go’s inlining policy.
https://docs.google.com/document/d/1a6p7-nbk5PVyM1S2tmccFrrIuGzCyzclstBtaciHxVw/edit
- How to migrate Go projects to a new domain using Caddyrocket9labs.com How to migrate Go projects to a new domain using Caddy
I recently migrated from rocketnine.space to rocket9labs.com, including a Forgejo instance. I have a number of projects, including many Go projects. I searched for a way to redirect to a new domain, while still allowing go get commands to work when referencing the old domain. I found this thread whi...
Hey all, I just wrote this up after migrating a metric ton of Go projects hosted on a Forgejo (Gitea) instance to a new domain by adding just a couple of lines to my Caddyfile. I thought the process would be much more involved, but the snippet I found and modified managed to handle everything without any tedious path rewriting or other vanity URL setup.
I hope it's helpful for someone else who needs to migrate to a new domain. I got an email from my registrar recently warning about a 60% price increase for .space TLDs. Careful readers may make a connection between this event and this blog post.
- proposal: review meeting minutes [2023-07-20]github.com proposal: review meeting minutes · Issue #33502 · golang/go
The proposal review group meets regularly (roughly weekly) to review pending proposal issues and move them along in the proposal process. Review consists primarily of checking that discussion is on...
Your weekly appointment with the latest news about accepted/declined proposals.
Noteworthy accepted proposal:
- Show off your project(s)!
I really like seeing people's interesting projects. Even if they are generic or were started just to learn something.
And on top of that, I consider Go to be one of those languages that you can find projects on a pretty diverse range of topics.
So, is there any interesting (or not too) personal Go projects that is in the making, or is already finished?
- Coroutines for Go
Why we need coroutines for Go, and what they might look like.
Another great post from Russ Cox, in his series on iterators and coroutines.
https://research.swtch.com/coro
- Storing Data in Control Flow
Write programs, not simulations of programs.
A great post from Russ Cox, setting the scene for his work on iterators and coroutines.
https://research.swtch.com/pcdata
- The Gorilla toolkit has maintainers againgorilla.github.io Gorilla, the golang web toolkit
Gorilla is a web toolkit for the Go programming language
- ccgo/v4 experiment: Trying the new runtime.Pinnermodern-c.blogspot.com ccgo/v4 experiment: Trying the new runtime.Pinner
tl;dr: Looking forward future Pinner.Pin performance improvements. The upcoming Go version 1.21, scheduled for release next month, is curre...
tl;dr: Looking forward future Pinner.Pin performance improvements.
The upcoming Go version 1.21, scheduled for release next month, is currently available for download as Go 1.21rc2 in the "Unstable version" section here. Go 1.21 introduces a new runtime type, Pinner.
ccgo/v4, the next, also not yet released version of the C to Go transpiler, uses pinning to "freeze" addresses of local Go variables, addresses of which are passed around in the original C code. ccgo produces Go code where any C pointer points to memory not managed by the Go runtime. So ccgo simply puts such "escaping" variables in the memory not visible to the garbage collector, with stable, immovable addresses. Those are provided by the modernc.org/memory package. Otherwise a goroutine stack resizing can change the address of a local variable.