« BackGo 1.25 Release Notesgo.devSubmitted by bitbasher 3 days ago
  • nulld3v 2 days ago

    New `encoding/json/v2` package (hidden behind `GOEXPERIMENT=jsonv2` flag)! It brings perf improvements and finally allows devs to implement custom marshalers for external types:

    > Alternatively, users can implement functions that match MarshalFunc, MarshalToFunc, UnmarshalFunc, or UnmarshalFromFunc to specify the JSON representation for arbitrary types. This provides callers of JSON functionality with control over how any arbitrary type is serialized as JSON.

    Awesome stuff.

    • tete 2 days ago

      > We expect the design of encoding/json/v2 to continue to evolve. We encourage developers to try out the new API and provide feedback on the proposal issue.

      Does anyone have more knowledge on what this refers to? I thought v2 being in as an experiment means they are happy with it, but "we expect it to evolve" sounds like "we know it's not good yet". Maybe I am understanding it the wrong way though. Just because other experiments were more like "this is new code, please test" and not "this will change".

      • neild 2 days ago

        It means we're not confident the API is stable yet. There might be further changes before the final, non-experimental version, depending on user feedback and further experience with the current proposal.

        In the case of encoding/json/v2, enabling GOEXPERIMENT=jsonv2 has two major effects:

        1. It flips encoding/json (the original, not /v2) to use the new implementation. This is supposed to be a fully backwards-compatible change, modulo some changes to the text of some errors. We're very interested to hear of any cases of existing programs breaking when the experiment is turned on, because (aside from the aforementioned error text, which you shouldn't be depending on) it likely indicates a bug that needs fixing. This is the "new code, please test" half of the change.

        2. It enables the new API (encoding/json/v2, encoding/json/jsontext, some new options in encoding/json). This is the "unstable API, might change in response to feedback" half of the change.

        • LambdaComplex 2 days ago

          Just because the Go maintainers think it's in an okay state doesn't mean the wider community won't have good ideas on how to improve it.

          • arccy 2 days ago

            Other experiments did change though: arena got dropped, synctest Run -> Test

            • MadcapJake 2 days ago

              Where is it mentioned that the arena experiment has been dropped?

              • typical182 2 days ago

                The arena experiment was essentially placed on indefinite hold:

                > The proposal to add arenas to the standard library is on indefinite hold due to concerns about API pollution.

                I think the parent comment was using arenas as an example that GOEXPERIMENTs don't always move forward (like arenas), or can change while still GOEXPERIMENTs in a way that would normally not be allowed due to backward compatibility (like synctest).

                The arena GOEXPERIMENT has not yet been dropped as of Go 1.25, but as I understand it, the plan is to remove arenas from the runtime when 'regions' are introduced, which have similar performance benefits but a much lower API impact:

                https://github.com/golang/go/discussions/70257

                As discussed there, seeing how people actually used the arena GOEXPERIMENT influenced the 'regions' design.

          • pbnjay 2 days ago

            Yes I was very excited to see the new json encoding changes land, can’t wait to try them out! The new omitempty and map key marshalling in particular will help clean up some of my ugly code.

            • kvemkon 2 days ago

              So now there is at least a workaround to preserve the order when processing JSON. Great!

              [1] https://github.com/golang/go/issues/27179#issuecomment-22899...

              • zx8080 2 days ago

                Wow, top comment about json. (Edit: not top 1 anymore, but still the point).

                It's ironic that the information technology and software engineering industry is so much "json parsing and repacking" one.

                • trenchpilgrim 2 days ago

                  To be fair, the existing json package in Go's standard library is somewhat infamous because it is non-streaming, so it has performance issues with large documents. one of the goals of json/v2 was to remedy this.

                  • the_gipsy 2 days ago

                    The irony is that go has taken the "web backend" niche, yet it sucks notoriously at JSON.

                    It's a complete joke TBH, and no amount of patching can ever fix zero-values, the root of all evil in go.

                    • majewsky 2 days ago

                      Zero values can, for the most part, be caught with a custom UnmarshalJSON implementation (and the new UnmarshalJSONFrom interface ought to remove most of the performance penalty associated with that). The one problem is what to do when the field is missing entirely, because then UnmarshalJSON(From) will never be invoked.

                      I have been thinking about suggesting a new struct field tag for JSON parsing: `json:',required'` that throws an error when the struct field is absent in the respective JSON object. The artifice is mostly in how to phrase that proposal in a way that makes it more likely for the Go devs to accept it. If I just come in like "I hate zero values", that may have some truth to it, but it's not going to be conducive to the discussion going the way I want.

                      • the_gipsy a day ago

                        That's the joke: you either make a whole new DSL that is then not even really that typesafe, or you just embrace pushing bad values into your system.

                        Because there is no standard or convention, everybody brings their own "nullable" wrappers between JSON, SQL, and whatnot, that are all half-baked and incompatible.

                        Look at rust/serde to see what it could have been.

                      • pjmlp 2 days ago

                        On my little corner of the universe, "web backend" means Java, .NET or nodejs, the set of languages that can run on top of any of those runtimes.

                        • the_gipsy 2 days ago

                          You're right, go has not "taken it over". I meant more that it has moved into that niche since its conception, while being really bad at dealing with JSON correctly.

                      • gwd 2 days ago

                        I mean, I get what you're saying, but the fact is

                        1. Golang is used in web and api servers

                        2. Json is the lingua franca of data for the web, so golang does a lot of json processing

                        2. The golang stdlib json packages haven't had much attention in the last decade

                        I was just thinking recently that my biggest pain point with the upstream JSON packages was the fact that you can't add easily add custom marshal / unmarshal code to objects in a package you don't control. I'm actually really excited about this change.

                        The other reason this is at the top of the list, of course, is that there are no major interesting language features being added. This is a combination of the fact that golang is a pretty mature language, and the slowness of the team to adding new language features; both of which I appreciate.

                    • disintegrator 2 days ago

                      I just love how this language marches forward. I have so many colleagues that hate many aspects of it but I sit here combining Go, Goa and SQLc writing mountains of code and having a fairly good compiler behind me. I understand what I’m missing out on by not using stricter languages and so often it’s a totally fine trade off.

                      • gottorf 2 days ago

                        Go is the only language where I've come back to a nontrivial source code after 10 years of letting it sit and have had zero problems building and running. That alone, for me, more than makes up for its idiosyncrasies.

                        • doublepg23 2 days ago

                          As a more sysadmin/ops focused guy it really is the killer feature. Static binaries and a more Java-esque resource profile than say Python are the cherries on top.

                          • pjmlp 2 days ago

                            I have worked in C++, Java and .NET codebases older than many HNer and still keep going strong.

                            • generichuman 2 days ago

                              Okay, C++ is believable, but can you really build a Java / .NET project that was not touched for 20+ years with no changes to the code or the build process (while also using the latest version of the SDKs)?

                              I imagine you can _make_ a project compile with some amount of effort (thinking maybe a week at most) but they wouldn't be exactly "unzip the old archive and execute ./build.bat".

                              • pjmlp a day ago

                                Yes, because Ant exists since 2000, Maven exists since 2004, and MSBuild since 2003.

                                Before it was a common procedure to have central package management, we used to store libraries (jars and dlls), on source control directly in some libs folder.

                                Afterwards, even with central package management, enterprise software when done right, is not calling the Internet in every build, rahter there are internal repositories that are curated by legal and IT, and only those packages are allowed to be used in projects.

                                So the tooling is naturally around after 20+ years, no one is doing YOLO project management when playing with customer's money.

                                As for the "...latest version of the SDKs..", that is moving the goal posts, there is no mention of it on,

                                > Go is the only language where I've come back to a nontrivial source code after 10 years of letting it sit and have had zero problems building and running. That alone, for me, more than makes up for its idiosyncrasies.

                                • gottorf 8 hours ago

                                  Ant and Maven have existed for a long time, but for me they didn't prevent Java (and other JVM language) projects from suffering significant bitrot in the build process.

                                  For example, I worked on a project that just stopped being able to be built with Maven one day, with no changes to the JVM version, any of the dependencies, or the Maven version itself. After a while I gave up trying to figure it out, because the same project was able to be built with Gradle!

                                  Older Scala projects were a pain in the ass to build because the Typesafe repositories stopped accepting plain HTTP connections, requiring obscure configuration changes to sbt. I've never had to deal with things like that in the world of Go.

                                  • generichuman 12 hours ago

                                    All fair, but:

                                    > As for the "...latest version of the SDKs..", that is moving the goal posts, there is no mention of it on [...]

                                    I thought it was implied since tooling & library breakages over the years happen and sometimes you can't just get the old SDK to run on the latest Windows / macOS. If the languages and Ant/Maven are backwards compatible to that extent, that's actually pretty good!

                                    I had to deal with moving a .NET Framework 4.7 project to .NET Standard 2.0 and it wasn't effortless (although upgrading to each new .NET release after that has been pretty simple so far). We took a couple of weeks even though we had minimal dependencies since we're careful about that stuff.

                              • Grokify 2 days ago

                                This. Maintainability and refactorability are some of the major Go superpowers for me which enables getting into any code base and updating it. These are supported by features like static typing, fast compile times, etc.

                                Of note, I've found this to be very important with AI generated code, where it's easy to grok and refactor AI code.

                                • zaphirplane 2 days ago

                                  In all fairness 10 years ago the deps would have been vendored in. Which side steps a whole set of problems if security, remote api version compat and features are not a major need

                                  • tete 2 days ago

                                    Yes, but with all the v2 in stdlib popping up we will get a lot of outdated code and a lot of "I need to know v1 and v2, because I will come across both".

                                    • Chiron1991 2 days ago

                                      But "outdated code" isn't inherently bad, is it? v1 code is still supported by the stdlib and it still does its job, at least until Go 2.x drops.

                                      • ayuhito 2 days ago

                                        In fact, v1 code usually uses v2 code under the hood, but with different options to maintain backwards compatibility.

                                        You still get performance improvements even if you don’t switch over to the new import!

                                        • Grokify 2 days ago

                                          A good example is io/ioutil. It's useful to migrate to eliminate the deprecation messages, but you don't need to do it right away.

                                          • majewsky 2 days ago

                                            Also, most of this can be automated with `go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest && modernize -fix ./...`

                                    • josephg 2 days ago

                                      I’ve had the same experience with old rust packages. But nothing quite so old - at least not yet!

                                      • fuzztester 2 days ago

                                        i have read that same point said multiple times on hn about both common lisp and perl, including in a recent thread about perl.

                                        • keyle 2 days ago

                                          The difference is that going back to Go code you've written a few years ago, isn't nearly as bad as going back to Perl code you've written a few years ago!

                                          • fredrikholm 2 days ago

                                            And having written a lot of Common Lisp, Go code is extraordinarily straight forward in a sense where every developer writes in almost the exact same style.

                                            This is not true for Common Lisp (even though it's not as bad as people make it out to be).

                                            I feel the exact same way with C versus C++, even if I was the person to write the C++.

                                          • thiht 2 days ago

                                            If someone said that about Perl, they're lying.

                                        • danudey 2 days ago

                                          I've gotten used to golang, though it's still not my favourite language to program in by any stretch. One issue I've been having, though, is the documentation.

                                          Documentation for third-party modules in Python is fantastic, almost universally so. In nearly every case of using a third-party library, large or small, there's sufficient documentation to get up and running.

                                          Golang libraries, however, seem to be the opposite. In most cases there's either no documentation whatsoever on how to use things, or, more commonly, there is example code in the readme which is out of date and does not work at all.

                                          The IDE integration with golang is great, and it makes some of this a bit easier, but I also still get a ton of situations where my editor will offer some field or function that looks like what I want (and is what I'm typing to see if it will autocomplete) but once I select it it complains that there's no such field or function. Still haven't figured that out.

                                          So yeah, I dunno. The language is 'great'; it certainly has some extreme strengths and conveniences, like the fact that 'run this function with these arguments in a separate thread' is a language keyword and not some deep dive into subprocess or threading or concurrent.futures; the fact that synchronization functionality is trivially easy to access; Sync.Once feels so extremely obvious for a language where concurrency is king, and so on.

                                          Still, the ecosystem is... a bit of a mess, at the best of times. Good modules are great, all other modules are awful.

                                          • marcus_holmes 2 days ago

                                            I think Go de-emphasises the ecosystem a lot.

                                            Generally gophers just use the standard library as much as possible. There isn't the usual set of "must-have" dependencies, and generally speaking when a gopher tries to solve a problem, the first step isn't to search for a 3rd party library that solves it for them.

                                            Obviously this is a broad generalisation and there are plenty of gophers who swear by using one or more libraries, and there are plenty of gophers who do rely on third-paarty dependencies. But this is still noticeably less prevalent than in many other languages, especially the more popular ones in web dev.

                                            As others have said, it also helps that Go code is easy to read and emphasises simplicity. The code is often more readable than the documentation, for sure. Whether you consider this bad documentation is up to you ;)

                                            • Grokify 2 days ago

                                              I enjoy the Go ecosystem quite a bit and haven't found many issues with documentation. I love how open source modules are documented on pkg.go.dev, including those from major providers, like AWS, Google, etc. Every library has the same references. When examples are useful, such as with charting modules, I've found that the projects do provide them. On the occasion where the README.md code is out of date, it's been easy for me to check pkg.go.dev and update it myself.

                                              • leoqa 2 days ago

                                                I quite frankly will just read the code. Go generally discourages abstractions so any code you jump into is fairly straightforward (compared to a hierarchy of abstract classes, dependency injected implementations, nested pattern matching with destructuring etc etc).

                                                Regarding your IDE issues- I’ve found the new wave of copilot/cursor behavior to be the culprit. Sometimes I just disable it and use the agent if I want it to do something. But it’ll completely fail to suggest an auto complete for a method that absolutely exists.

                                                • treyd 2 days ago

                                                  > Go generally discourages abstractions so any code you jump into is fairly straightforward

                                                  This is a really anti-intellectual take. All of software engineering is about building abstractions. Not having abstractions makes the structure less easy to understand because they're made implicit, and forces developers to repeat themselves and use brittle hacks. It's not a way to build robust or maintainable software.

                                                  • bjt 2 days ago

                                                    Go does have plenty of abstractions.

                                                    I think the more charitable interpretation is "Go generally discourages metaprogramming." Which I would agree with, and I think positively distinguishes it from most popular languages.

                                                    • eru a day ago

                                                      Go mostly only have abstractions that the language designers put into the language. It is (mostly) hostile to users defining their own new abstractions.

                                                      A case in point is that arrays and maps (and the 'make' function etc) were always generic, but as a user until fairly recently you couldn't define your own generic data structures and algorithms.

                                                    • packetlost 2 days ago

                                                      Go discouraging abstracts is sorta just... wrong anyways. Go doesn't discourage building abstractions, it discourages building deep / layered abstractions.

                                                      • cryptos 2 days ago

                                                        That is a key point in my opinion. A typical stack trace of a Spring (Java) application can easily be 1000 to 2000 lines long. That is not so common in Go, as far as I know (I'm not a Go expert ...).

                                                        • tcfhgj 2 days ago

                                                          Building abstractions and adding more layers goes hand in hand, e.g. see OSI layers.

                                                          So GI indeed discourages abstractions.

                                                          • packetlost 2 days ago

                                                            Not really, it's more like it encourages "wide" abstraction (lots of shallow abstractions) that get pieced together vs heavily nested abstractions that encapsulate other abstractions. It's a very imperative language.

                                                        • undefined 2 days ago
                                                          [deleted]
                                                          • Mawr 2 days ago

                                                            Did you cherry pick that part of the sentence and ignored "(compared to a hierarchy of abstract classes, dependency injected implementations, nested pattern matching with destructuring etc etc)." on purpose or?

                                                            • treyd 2 days ago

                                                              Yeah this is exactly the stuff that you'll have to reinvent yourself on an ad-hoc basis in any sufficiently large project.

                                                              I would argue it's sorta related to Greenspun's tenth rule: https://en.m.wikipedia.org/wiki/Greenspun%27s_tenth_rule

                                                              Of course, you'll probably retreat and say "Go is better for small projects", but every large project started as a small one, and it's really hard to justify rewriting a project in a new language in a business context.

                                                              • samdoesnothing a day ago

                                                                You don't need a hierarchy of abstract classes, dependency injected implementations, nested pattern matching with destructuring, etc for any project. If one decides to implement these techniques in an ad-hoc basis in Go to solve problems, that's more to do with trying to apply principles and techniques from other languages in Go.

                                                            • jen20 2 days ago

                                                              Nor is Spring Boot with hidden implicit behaviour all over the show. Nor are AbstractProxyFactoryBeans, or IOC containers.

                                                              Code you can read and understand linearly and end to end is hugely underrated.

                                                            • osigurdson 2 days ago

                                                              >> Go generally discourages...

                                                              Really, there is nothing in the language that prevents you from creating crazy AbstractFactoryFactories or doing DI. What really prevents this is the community. In enterprise C# / Java, insanity is essentially mandated.

                                                            • mayama 2 days ago

                                                              Generally I found updated example in one of the test files. Or I could understand how to use library by reading test files in the repo. For me it's the opposite problem, python documentation is too long in some cases and it's not intuitive to find what I want if it's not trivial, and had to use websearch or llm.

                                                              • wizhi 16 hours ago

                                                                Python package documentation is abysmal. It tends to read like a novel and yet still only covers surface layer details with simplistic examples. It's next to impossible to just "get an overview" of what's available: just show me the modules, classes, functions, etc. Don't make me spend 30 minutes trying to find an explanation for that one function which just takes a kwargs, which ends up only being covered in thr footnote of some random page in the documentation on something otherwise completely unrelated.

                                                                It's madness.

                                                              • cmckn 2 days ago

                                                                I wrote a lot of Java in a past life, and the documentation situation is night and day, for sure. I think it's partly a syntax/tooling issue, and partly a cultural thing. Luckily Go's standard library (+ `/x/` modules) lets me avoid third-party dependencies in many cases. The documentation from the Go team is very good in my opinion.

                                                                • antibios 2 days ago

                                                                  This is so true and unfortunate because golang has an inbuilt example function that closely follows the test functions. It means that all that really needs to change is how godoc promotes or badges libraries with examples.

                                                                • djfobbz 2 days ago

                                                                  Any language that helps me put food on my family table is a good language. For me, that has been the case with both Ruby and Go.

                                                                  • devmor 2 days ago

                                                                    I did not like it at first but it has grown on me. I still have my gripes, which are mostly things that come from its overall architecture and will never be resolved, but it is pretty enjoyable to use for the limited domain I use it in at work.

                                                                    • christophilus 2 days ago

                                                                      I love it because the average Go project has so few dependencies.

                                                                      • lenkite 2 days ago

                                                                        Only if you are not using Kubernetes.

                                                                        • jen20 2 days ago

                                                                          While I agree, one thing that would really help there is the notion of test dependencies separate from ones that will end up in a production binary.

                                                                          Testify in particular is widely used in tests yet pulls in an entire YAML parser.

                                                                      • dotwaffle 2 days ago

                                                                        Just watch as most libraries now update their go.mod to say 1.25, despite using no 1.25 features, meaning those who want to continue on 1.24 (which will still have patch releases for six months...) are forced to remain on older versions or jump through lots of hoops.

                                                                        It's a "minimum" version, not a dependency lock!

                                                                        • bitbasher 2 days ago

                                                                          This is a common issue with Rust projects as well. At least with Rust you have the idea of "MSRV" (minimum supported rust version). I've never heard it discussed within Go's community.

                                                                          There's no MSGV. Everyone pins the latest.

                                                                          This also plagues dependencies. People pin to specific version (ie, 1.23) instead of the major version (at least 1.0 or at least 1.2, etc).

                                                                          • dotwaffle a day ago

                                                                            The "go x.yy" line in go.mod is supposed to be that MSGV, but `go mod init` will default it to the current version on creation. While you could have tooling like `cargo-msrv` to determine what that value would be optimal, the fact that only the latest two Go versions are supported means it's not particularly useful in most cases.

                                                                          • konart 2 days ago

                                                                            >Just watch as most libraries now update...

                                                                            Haven't seen anything like this. Most packages actually have 1.13 in their go.mod

                                                                            Rarely do I see at least 1.19

                                                                            • dotwaffle 2 days ago

                                                                              Now that I think about it more, when I've seen it happen before, it tends to be on projects that use dependabot / renovate. If any of those updates depend (directly or transitively) on a later version of Go, the go.mod would be bumped accordingly for them.

                                                                              I have a vague feeling it was related to testcontainers or docker, and at the time that job's Go install was always at least 6 months behind. At least with recent Go, it'll switch to a later version that it downloads via the module proxy, that would have helped a lot back then :S

                                                                            • lordofgibbons 2 days ago

                                                                              Never seen this happen. Most popular libraries support at least 2 previous versions

                                                                            • Gobd 2 days ago

                                                                              Yay new version! Not the most exciting (as Go releases tend to be which is good), but hopefully jsonv2 and greentea can get some testing and be standard in 1.26

                                                                              • latchkey 2 days ago

                                                                                > greentea

                                                                                I didn't know what it is and had to look it up. Looks like a new GC.

                                                                                https://github.com/golang/go/issues/73581

                                                                                • halJordan 2 days ago

                                                                                  Is reading the posted article just something we don't do anymore?

                                                                                  • rs186 2 days ago

                                                                                    To be fair, I read the article but still don't know what greentea is. The article never directly refers to the new GC by this name. It appears in a command line option value, that's about it.

                                                                                    • vips7L 2 days ago

                                                                                      > The new garbage collector may be enabled by setting GOEXPERIMENT=greenteagc at build time

                                                                                      I don’t know if you’d count that as directly referring to it by name but it’s there.

                                                                                      • rs186 a day ago

                                                                                        The sentence reads

                                                                                        The new garbage collector may be enabled by setting [blurred] at build time

                                                                                        to me, where exact flag value is automatically ignored, because I don't care what's in there. I don't pay attention to such irrelevant details

                                                                                        • vips7L 21 hours ago

                                                                                          Yeah that’s extremely fair.

                                                                                    • latchkey 2 days ago

                                                                                      Haven't done that in ages. I open both the page and the comments. The first few comments usually dictate if I'm going to bother with the page.

                                                                                      What I want next is just an AI summary of the comments with vibe analysis ("Is this worth reading?).

                                                                                      • awesome_dude 2 days ago

                                                                                        If people were intended to read we wouldn't have to yell at them to RTFM!!

                                                                                  • abtinf 2 days ago

                                                                                    WaitGroup.Go looks great. Going to be able to delete a lot of code, replacing boilerplate with calls to it.

                                                                                    • lenkite 2 days ago

                                                                                      I wish they moved ErrorGroup into the base standard library itself. Most functions return errors in Go anyways.

                                                                                    • ptman 2 days ago

                                                                                      Interactive tour of new features: https://antonz.org/go-1-25/

                                                                                      • nunez 2 days ago

                                                                                        > LookupMX and Resolver.LookupMX now return DNS names that look like valid IP address, as well as valid domain names. Previously if a name server returned an IP address as a DNS name, LookupMX would discard it, as required by the RFCs. However, name servers in practice do sometimes return IP addresses.

                                                                                        This one is interesting; which servers return an IP address as a record? Why would they want to do this?

                                                                                      • truth_seeker 2 days ago

                                                                                        > TLS servers now prefer the highest supported protocol version, even if it isn’t the client’s most preferred protocol version.

                                                                                        >Both TLS clients and servers are now stricter in following the specifications and in rejecting off-spec behavior. Connections with compliant peers should be unaffected.

                                                                                        This is nice.

                                                                                        • kristianp 2 days ago

                                                                                          Includes [1], which fixes the bug which was blogged about in "How we tracked down a Go 1.24 memory regression" [2,3].

                                                                                          [1] https://github.com/golang/go/issues/72991

                                                                                          [2] https://www.datadoghq.com/blog/engineering/go-memory-regress...

                                                                                          [3] https://news.ycombinator.com/item?id=44597550 (24 days ago)

                                                                                          • bitbasher 3 days ago
                                                                                            • cryptos 2 days ago

                                                                                              Or was the _software_ released, labeled with this tag? Sorry, to split hairs. ;-)

                                                                                              • bitbasher 2 days ago

                                                                                                That's a good question. At the time of posting, the release download was unavailable on go.dev/dl

                                                                                                So.. was the software released? Schrodinger's release.

                                                                                            • tonymet 2 days ago

                                                                                              i love how complete golang tooling is. go/analyzer framework is quite advanced and I don't know of other languages that offer accessible AST support .

                                                                                              • foresto 2 days ago
                                                                                                • tonymet 2 days ago

                                                                                                  not really. that's just an API. i mean all of the tooling and how commonly the API is put to use

                                                                                                • whartung 2 days ago

                                                                                                  JDK, I believe, has first class support for accessing the Java AST.

                                                                                                  • cryptos 2 days ago

                                                                                                    There are some internal compiler APIs (so, not officially supported) and some external tools to do so.

                                                                                                  • Zambyte 2 days ago

                                                                                                    Go is one of the last languages I'd think about when considering access to the AST. The first would be Lisp.

                                                                                                    • tonymet 2 days ago

                                                                                                      there are tons of utilities. and the fact that i've written some means it's pretty easy

                                                                                                      • Zambyte 2 days ago

                                                                                                        Right, I'm not saying it's impossible in Go, but it's so easy in Lisp you're bound to do it even by accident. There are no "AST utilities" in Lisp because the AST is just a normal list / tree of primitive values (of the `symbol` type). You operate on code structures with the same libraries that you operate on a list / tree of numbers, strings, etc. Code is data.

                                                                                                    • trenchpilgrim 2 days ago

                                                                                                      Lisp and Lua both have good AST support.

                                                                                                      • gsck 2 days ago

                                                                                                        Not sure where youve learnt that Lua gives you access to the AST considering Lua doesn't build an AST

                                                                                                        • trenchpilgrim 2 days ago

                                                                                                          I gotta admit I never formally learned Lua in any rigorous way, I just picked up enough to script with it in existing codebases. I'll often write Python scripts that manipulate Lua programs, for example.

                                                                                                    • undefined 2 days ago
                                                                                                      [deleted]
                                                                                                      • undefined 2 days ago
                                                                                                        [deleted]
                                                                                                        • tete 2 days ago

                                                                                                          > LookupMX and Resolver.LookupMX now return DNS names that look like valid IP address, as well as valid domain names. Previously if a name server returned an IP address as a DNS name, LookupMX would discard it, as required by the RFCs. However, name servers in practice do sometimes return IP addresses.

                                                                                                          Ah, intentionally making code not standards compliant.

                                                                                                          • thiht 2 days ago

                                                                                                            Reality compliant > standards compliant.

                                                                                                            • porridgeraisin 2 days ago

                                                                                                              Standards are toilet paper in the general case. Only in the rare cases where reality matches it does it matter.Anyone can write anything on a piece of paper. What code is executing on the DNS server at the end of the day is what matters.

                                                                                                            • kristianp a day ago

                                                                                                              I'd be interested to know more about the faster slices changes. Haven't been able to find anything published about it.

                                                                                                              • nikolayasdf123 2 days ago

                                                                                                                have been looking toward this release for quite some time!

                                                                                                                • undefined 2 days ago
                                                                                                                  [deleted]
                                                                                                                  • pjmlp 2 days ago

                                                                                                                    [flagged]

                                                                                                                    • Mawr 2 days ago

                                                                                                                      Could you kindly stop shitposting?

                                                                                                                      • pjmlp 2 days ago

                                                                                                                        Could you kindly ignore my comments?

                                                                                                                      • jen20 2 days ago

                                                                                                                        > Also what is the idea of everything is delivered in source now

                                                                                                                        Basic sanity.

                                                                                                                      • anal_reactor 2 days ago

                                                                                                                        [flagged]

                                                                                                                        • dwb 2 days ago

                                                                                                                          Readability debates are usually boring because it’s so subjective, but in this case it’s just your (admitted!) unfamiliarity. Lots and lots of people would disagree with you that Go is unreadable. Go isn’t pretty or cute, but one of its strengths is its relative clarity. All languages require some familiarity to read properly.

                                                                                                                          • rkomorn 2 days ago

                                                                                                                            > but one of its strengths is its relative clarity

                                                                                                                            How you define "relative clarity" in a way that isn't "so subjective" and not immediately due to familiarity?

                                                                                                                            To me it seems like you're saying it's all subjective except for Go's relative readability, but I'm not sure what's making said relative readability any less subjective.

                                                                                                                            Am I reading your comment wrong?

                                                                                                                            • dwb 2 days ago

                                                                                                                              It is all subjective, but if a large number of subjects have a consistent opinion then that is something to take seriously rather than dismiss with absurd hyperbole (“most garbage”, “mostly unreadable”).

                                                                                                                            • anal_reactor 2 days ago

                                                                                                                              > but in this case it’s just your (admitted!) unfamiliarity

                                                                                                                              That's exactly the problem. Golang has syntax different from other imperative languages not because its syntax brings something new to the table, but just for the sake of being different. In other words, it's an entry barrier that provides nothing in return.

                                                                                                                              To illustrate my point, imagine someone coming up with a new measurement unit "my_unit" equal to 0,73926745 cm. The first question is "why" because it solves zero problems for which the metric system would be impractical, while adding new cognitive load for people trying to use it. And then there's the counterargument "you're just not familiar with it!" which is a fair point because objectively, you can't say that either centimeter or "my_unit" is better. It's just that it's unnecessary cost of switching from already applied standard that works equally well.

                                                                                                                              • dwb 2 days ago

                                                                                                                                > Golang has syntax different from other imperative languages

                                                                                                                                No it doesn’t, it’s very similar to C.

                                                                                                                            • mathiaspoint 2 days ago

                                                                                                                              Admittedly I haven't touched go in around ten years so I'm sure things have changed but I remember being really surprised by how readible it was and how I could jump straight into codebases I had never seen before.

                                                                                                                              • LambdaComplex 2 days ago

                                                                                                                                I would genuinely love to hear your specific complaints about Go's syntax.

                                                                                                                                • dada216 2 days ago

                                                                                                                                  anal_reactor started with "once I read on 4chan". that's all you should need to know to skip this entirely

                                                                                                                                  • anal_reactor 2 days ago

                                                                                                                                    My first problem is "where the fuck is this function defined" and then "what is this type actually". Answering these two questions for random line in random code is surprisingly difficult.

                                                                                                                                    • majewsky 2 days ago

                                                                                                                                      > what is this type actually

                                                                                                                                      Do you mean that you don't know what type a certain variable has? If so, just add `theVariableName = false` and try to compile it (or just `go vet ./path/to/folder` from the repo root) and the error message will tell you the type. Same as with every other strongly typed language.

                                                                                                                                      • alain_gilbert 2 days ago

                                                                                                                                        Or if he was to use any kind of decent text editor, he could also just place his mouse over the variable and see the type it has.

                                                                                                                                        Then comes the hard part "where is it defined"... he could even press "command" and then click on it.