wyri, to php
@wyri@haxim.us avatar

Kinda forgot how much fun it was to write code stitching map tiles together, and also how easy it was. Currently at 82 lines of . Once finished it will be a new package, as the has some massive glaring bug in it that took me 6 years to find. Sprinkling some threads and over this once it's done. The home clusters fans will sing once more

buherator, to golang
@buherator@infosec.place avatar

This latest writeup by @joern mentions the of Go’s filepath.Clean is “not really obvious” when dealing with relative paths.

I think this is something all devs should be aware of to avoid similar vulnerabilities.

The language is kind of amazing:

  • Step 3. only applies if there is a parent path to be eliminated together with the subsequent “..” (“/foo/..” -> “/“)
  • Step 4. only applies to “rooted” (absolute) paths, so “/../foo” would become “/foo”, but “../“ is left untouched (as there is no relative parent path to eliminate either).

This makes the docs technically correct (“the best kind of correct!”), but even with the solution at hand it took some head scratching to figure out the true meaning.

excds, to golang
@excds@berlin.social avatar

For a work project it seems we will have to implement a library for building/evaluating ODRL statements. Since I haven't previously started such a parser library project, I would like suggestions on projects I could look at for inspiration in

  • Ease of use in interfaces
  • Test structure
  • Generally nice code

Please post links to projects you think are nice to use. Oh, and please boost for bigger reach.

dusnm, to golang
@dusnm@fosstodon.org avatar

Writing a spec compliant implementation of a server that receives webmentions in .

Making sure I cover all edge cases is so time consuming...

mort, to Kotlin
@mort@fosstodon.org avatar

I can't deal with languages with optional semicolons! I like languages without semicolons, but when they're optional, especially if they feel "C-like", I always end up adding semicolons to some lines even when I try to write in a semicolon-less style. I'm writing some now and I decided to just use semicolons consistently because the alternative is seemingly to use them inconsistently.

Strangely, this isn't an issue I have in . I do have it in however.

TehPenguin, to rust
@TehPenguin@hachyderm.io avatar

When posting your programming language comparison article, can you please include the context of your comparison?

"Rust vs Python, which is better? "
"Sir, this is a kernel"

"Why I switched from C++ to Go"
Taps sign: "No GC or green threads in the kernel"

Sincerely, a systems dev who'd like to remind you that APIs existed before REST...

mackuba, to ruby
@mackuba@martianbase.net avatar

Current status: I opened about 100 links to articles and threads from Google results comparing , and and I'm planning to read them 🫠

(no, I'm not really considering Go, mostly just trying to convince myself that I'm not making a mistake starting to learn Rust and not Go 🦀😛)

mackuba, to golang
@mackuba@martianbase.net avatar

It's insane that I can have a conversation with this thing and in a few moments and a few back and forths build a working program in a language I know nothing about (I don't know Go)… don't tell me this isn't huge 😳

You: One modification - this current code counts all matches of all regexps against the text. So if one line of text matches two or more regexps, it will be counted as 2 or more. I want a given line of text to only be counted once if it matches
You: What's the command to compile this to a binary? ChatGPT: To compile a Go program to a binary, you can use the go build command followed by the name of the Go file you want to compile. If you want to specify the output binary name, you can use the -o flag followed by the desired name. Assuming your Go file is named main.go, you can compile it to a binary named my_program like this: You: Looks like
You: Great, that works 👍 Is there some way to compile this program in "release mode", with a more optimized version or something? ChatGPT: Yes, you can compile your Go program in release mode with optimizations using the go build command with the -ldflags flag set to -s -w, and the -trimpath flag set to remove the build path from the resulting binary. Here's the command to compile your program in release mode: You: I mean, not optimizations for binary size, but optimizations to make it faster? ChatGPT: Ah, I see! In Go, optimization for speed primarily comes from the compiler's default optimizations, and there isn't a direct flag to enable additional optimizations beyond what the compiler already does. However, there are some general principles you can follow to improve the performance of your Go program: Profiling: Use Go's profiling tools (go test -cpuprofile, go tool pprof, etc.) to identify bottlenecks in your code and optimize them. Profiling helps you understand (…)

publicvoit, to programming
@publicvoit@graz.social avatar

What happens, when you join two paths in a #programming language when the second one is an absolute one?

join("foo", "/bar")
returns "foo/bar" or "/bar"?

The wonderful @meisterluk wrote a great article about that you might want to read: https://lukas-prokop.at/articles/2024-05-03-filepath-join-behavior

I can not tell what version I'd actually prefer. There are situations where both versions would be "proper".

#Python #Golang #UNIX #POSIX #rust #C++ #CPP #Java #dotNet #Dart #Flutter #Dlang #TCL #Nim #FreePascal #PowerShell #zig

changelog, to opensource
@changelog@changelog.social avatar

🦾 New Changelog & Friends!

Our friend @deadprogram joins @jerod & @adam to discuss:

🎈 high-altitude weather balloons
🧑‍🚀 Human life on Mars
🤔 Zeno’s paradox applied to ML
🎶 open source the Wu-Tang way
➕ and much more!

This is a good one, enjoy! https://changelog.com/friends/42

markus, to golang
@markus@hachyderm.io avatar

I released a new version of my module for persistent message queues based on today. I added a basic job runner, since that’s one of the things I most use a queue for. Check it out at https://www.goqite.com

ferki, to gentoo
@ferki@fosstodon.org avatar

I'm going to host an online workshop for the Gentoo e.V. on 2024-06-15 about how to "Host Gentoo dependency tarballs as GitHub releases".

I'll show how to use GitHub for dependency tarballs as an external , such as a proxied maintainer, a GURU committer, or an overlay .

I use this approach to package software, and it can be applied to other similar situations, or even automated through local scripts or GitHub Actions.

https://gentoo-ev.org/news/online-workshops-2024/

preslavrachev, (edited ) to programming
@preslavrachev@mastodon.social avatar

One more time, I've made my way to the Golang Weekly newsletter! Thanks for featurng my random ramblings on Go 🙏

https://golangweekly.com/issues/505


fallenhitokiri, to golang
@fallenhitokiri@social.screamingatmyscreen.com avatar

Bubble Tea for is the first TUI library I touched that doesn’t make me regret writing a TUI.

The examples, documentation and video tutorials also make it super easy to get started or stitch together the parts you need.

Overall this is just a really good library from a developer perspective.

rsc, to golang
@rsc@hachyderm.io avatar

“Evolving the Go Standard Library with math/rand/v2”
https://go.dev/blog/randv2

vascorsd, to programming
@vascorsd@mastodon.social avatar

Borgo Programming Language
https://borgo-lang.github.io/

Borgo is a new programming language that compiles to Go.

Ant8e, to golang
@Ant8e@fosstodon.org avatar

Probably what go should have been in the first place

https://borgo-lang.github.io/#intro

guardianproject, to golang

's core crypto/tls library merged client support! It should be included in the Go v1.23 release. Server-side support is still in the works.

https://go-review.googlesource.com/c/go/+/578575

sirber, to Laravel
@sirber@fosstodon.org avatar

#Laravel / Eloquent looks way easier than #nestjs / typeorm and #go / #gin / #gorm 😅

#php #webdev

sirber,
@sirber@fosstodon.org avatar

@Crell In , I would just mock the repository layer and do no db calls 😅

alyx, to golang
@alyx@3615.computer avatar

I'd like to find more YouTube channels about software development / engineering / etc but it's like 98% of the same white guy, screaming like a twitch streamer, making almost every video about "this is X killer" "why you should NEVER do that" or "your IDE is shit use X instead". Of course they talk like they are the thing and it's the only truth.

Any recommendations? interested in or anything related

preslavrachev, to programming
@preslavrachev@mastodon.social avatar

How long, before Google ditches the Go team too, and what would that mean for its future adoption?

https://simonwillison.net/2024/Apr/27/everything-googles-python-team-were-responsible-for/


wilson, to golang

This weekend, I hacked together a markdown documentation generator for Postgres in Go. It should be extensible to other databases, as well as including other properties from database.

It's called SQLDoc — please check it out!

https://husin.dev/sqldoc/

sirber, to python
@sirber@fosstodon.org avatar

I think it's better to learn than catch up on ? 🤔

sirber,
@sirber@fosstodon.org avatar

It's sad that I see almost no job in .

mid_kid, to golang
@mid_kid@fosstodon.org avatar

Downloading 300MB+ of #golang dependencies for a single program like disk space don't matter 😎

#gentoo #gnu #linux

EricMesa, to golang

A few thoughts on Programming languages

Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each programming language leads to some interesting choices, as is the case with spoken languages.

This week I started learning how to program in Rust. Even though I’m using the project-based Command-Line Rust to learn, the author still went with the traditional “Hello, world!” project for the first intro to the language. I was also working on a Go project last week and so it immediately stood out to me that (at least as taught by this author) Rust has the print! macro that allows you to succinctly print to the command line. By contrast, Go requires importing fmt before you can print. This was the first topic that was swirling around in my head this week. What makes language designers choose whether printing output (one of the most basic things a program can do) is built-in or requires an import. I even remember back when I was learning Java in undergrad (I think it was Java 1.8, but I don’t remember) we had to use the savitch library just to get program input (another very basic computer program concept). As I thought about it, I wondered if it has to do with thoughts around compilation and whether the language designers think you’re mostly making user-interactive programs or libraries? It makes sense to me that scripting languages like Python, Ruby, and Perl would have print built-in since you always have to have the interpreter along with you, so all the basics should be there. (The original Batteries Included Python promise, for example) But perhaps the Go developers thought you wouldn’t always be printing to the command line so a more efficient binary could be compiled by forcing you to import the functionality? I’m not entirely sure.

The next thing I started thinking about, again due to learning Rust, was the mutability of variables. In most languages I’ve come across (I think all, except Haskell) all variables are mutable by default. It almost seems pointless to have a non-mutable variable. I understand why many languages have the concept of a “contanst” modifier/keyword. Unlike normal variables, THIS ONE does not change. But the opposite seems so weird since most of what we often do in programming involves changing the value in a variable. Perhaps as I learn more about Rust, I’ll understand their reasoning, but this seems completely backwards to me.

Both Rust and Golang use structs to organize variables where Ruby, Python, and Java use objects. But when both Go and Rust allow you to “attach” methods/functions to structs – is there a true distinction between object-oriented programming and struct-based programming? It seems like it’s just semantics (in the generic sense of the word) – at least at the level at which I program. The only difference I can see is that structs don’t have inheritance, although Go’s “types” solve some of the same problems.

Today’s (the day I’m writing this, not the day it’s going to be posted) shower thought was about programming language versions. On one end you have Java (I think now on version 22) and C# (now at version 12). On the other you have Python and Ruby (both at version 3). Perl essentially stopped at 5 with Perl 6 evolving into Raku. I don’t know what Java is up to. But I think C# is actually using the versions correctly – I’ve heard that each version introduces completely different ways of doing things and that the way you program C# depends strongly on when you jumped in. This is why Python is probably never moving to v4 unless they need to make some kind of huge change. Rust is an outlier with year-based versions. I guess that’s fine, but doesn’t tell you anything like a proper semantic versioning could.

Finally, I know that Rust is the newest of all the programming languages I’ve learned, but I really love how new projects are started. Python isn’t horrible, but it’s currently suffering from a lots of ideas, none of which has complete market share. You could do a simple virtual environment or you could do a more complex virtual environment/lock file situation with Poetry. (And there are about another half dozen variations on these two themes) But Rust….Rust deserves a chef’s kiss. When you start a new project with “cargo new project-name”, not only does it set up your directory structure, but it does a whole bunch of great setup tasks. It creates your Cargo.toml file (with Python, which only really started supporting toml files at the project level a few years ago, you need to look at documentation to figure out what goes in there) so that you have all the basics in there already. But it doesn’t stop there! It also, in a nod to modern programming, creates a git repository AND a gitignore file. It’s a thing of beauty. I would absolutely love for Python to move in this direction officially (not through a random user choice) for their defaults. Even “go mod init” could benefit from setting up a git repo and a git ignore (since the toml is not how Go works – I think they would probably best set up a README.md since Go’s default packaging is through git repos).

https://wp.me/p5cs3g-4HT

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • Durango
  • ngwrru68w68
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • DreamBathrooms
  • Youngstown
  • slotface
  • vwfavf
  • PowerRangers
  • everett
  • kavyap
  • rosin
  • Leos
  • khanakhh
  • tacticalgear
  • InstantRegret
  • cubers
  • mdbf
  • ethstaker
  • osvaldo12
  • GTA5RPClips
  • cisconetworking
  • tester
  • normalnudes
  • modclub
  • provamag3
  • All magazines