Hacker News new | past | comments | ask | show | jobs | submit login

>I've had this a few times, most recently with "how do I add this data file to my binary". At least that one made it to master now, and will be in 1.16!

Wait, how?? I've done some unholy things.




The best example for the new '//go:embed' directive I've seen so far is this:

  package main
  
  import (
      "embed"
      "net/http"
  )
  
  //go:embed assets/*
  var assets embed.FS
  
  func main() {
      fs := http.FileServer(http.FS(assets))
      http.ListenAndServe(":8080", fs)
  }
For the next month, the list of options here [0] will have to suffice.

0: https://go.googlesource.com/proposal/+/master/design/draft-e...


Or you can just use the 1.16beta compiler


That's beautiful.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: