Feddit.it
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
austin@programming.devM to Golang@programming.devEnglish · 2 年前

Go’s best-kept secret: executable examples

bitfieldconsulting.com

external-link
message-square
5
link
fedilink
20
external-link

Go’s best-kept secret: executable examples

bitfieldconsulting.com

austin@programming.devM to Golang@programming.devEnglish · 2 年前
message-square
5
link
fedilink
Go’s best-kept secret: executable examples — Bitfield Consulting
bitfieldconsulting.com
external-link
Did you know that Go lets us provide executable code examples as part of our documentation? It’s pretty neat. Let’s take a tour of this useful feature and see how it works.
  • morgen@infosec.pub
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 年前

    I have not seen this before. Thanks for sharing. Do you know any projects that utilize this, so I can see an example implementation of this?

    • Oliver Lowe@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 年前

      Do you know any projects that utilize this, so I can see an example implementation of this?

      The sort package in the standard library uses testable examples (source code).

    • RandomDevOpsDude@programming.devM
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 年前

      ExampleEcho

      going to

      func Echo doc Example

      (and many more)

    • austin@programming.devOPM
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 年前

      The go stdlib uses it a lot. For example, the strings package

Golang@programming.dev

golang@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !golang@programming.dev

This is a community dedicated to the go programming language.

Useful Links:

  • Go Website
  • Effective Go
  • Go by Example
  • How to Start a Go Project

Rules:

  • Posts must be relevant to Go
  • No NSFW content
  • No hate speech, bigotry, etc
  • Try to keep discussions on topic
  • No spam of tools/companies/advertisements
  • It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 15 users / week
  • 49 users / month
  • 239 users / 6 months
  • 4 local subscribers
  • 2.54K subscribers
  • 232 Posts
  • 346 Comments
  • Modlog
  • mods:
  • Ategon@programming.dev
  • RandomDevOpsDude@programming.dev
  • austin@programming.dev
  • BE: 0.19.12
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org