[{"data":1,"prerenderedAt":345},["ShallowReactive",2],{"project-48225338":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":43,"post_text":45,"what":46,"said":75,"maker_in_thread":154,"shape":156,"grid":161,"attempts":308,"same_week":309,"maker_shows":31,"maker_hidden":338,"reader_version":339,"card":340},"48225338","gobee","Write your BPF programs in Go, not C","title","Show HN: Write your BPF programs in Go, not C","https:\u002F\u002Fgithub.com\u002Fboratanrikulu\u002Fgobee","github.com","boratanrikulu",1779380746,2026,112,52,605,4366,14,"notable","dev_tools","code generator","cli",[24,25,26,27],"ebpf","go transpiler","bpf c code generation","clang bpf","mixed",-0.29,{"positive":31,"neutral":32,"mixed":31,"critical":33},2,5,7,16,{"idea":36,"execution":39,"docs":40,"design":42},{"positive":37,"critical":38},1,4,{"positive":37,"critical":37},{"positive":41,"critical":31},0,{"positive":41,"critical":41},[37,37,44,41,41,41,44,37,41,41,37,41,41,44,32,37,41,41,44,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,37,44,41,37,44,32],3,null,{"problem":47,"audience":45,"pricing":45,"motivation":45,"time_to_build":45,"stack":57,"openness":74,"stage":74,"team_size":74},{"value":48,"source":49,"evidence":50},"Writing eBPF programs without writing C","inferred",[51,53],{"id":52},"post",{"id":54,"by":55,"text":56},"48272484","badc0ffee","In eBPF-land you're going to be calling C functions in the kernel, and using (generally) C data types like structs and null-terminated strings. You can't do loops (loops are…",[58,62,70],{"value":59,"source":49,"evidence":60},"Go",[61],{"id":52},{"value":63,"source":64,"evidence":65},"C","commenter",[66],{"id":67,"by":68,"text":69},"48272919","hnlmorg","> Why transpile, not generate BPF directly > gc, the Go compiler, has no LLVM-based BPF backend. Adding one is a multi-year compiler project. rustc is built on LLVM and that's…",{"value":71,"source":64,"evidence":72},"clang",[73],{"id":67,"by":68,"text":69},"unknown",{"praise":76,"objections":88,"requests":103,"questions":112,"alternatives":120},[77],{"value":78,"source":64,"evidence":79},"Good idea for sharing types between kernel and userspace code",[80,84],{"id":81,"by":82,"text":83},"48282512","danudey","I think the real benefit here is being able to share structures, etc. with userspace and keep them in sync. If this was compiling the Golang to BPF then yeah, that would feel…",{"id":85,"by":86,"text":87},"48275095","nathannaveen","I'm also primarily a Go developer, and I will also defend the language in almost all use cases, but I personally feel that C is the best for writing eBPF. I just feel that you…",[89,98],{"value":90,"source":64,"evidence":91},"C is the better fit for eBPF; Go adds no value",[92,93,97],{"id":54,"by":55,"text":56},{"id":94,"by":95,"text":96},"48273059","razighter777","Remember, a lot of the memory safety benefits from go and rust and eBPF don't apply to the kernel eBPF! Kernel eBPF enforces semantics that verify array and loop bounds, memory…",{"id":85,"by":86,"text":87},{"value":99,"source":64,"evidence":100},"Go's runtime features don't apply in kernel eBPF",[101,102],{"id":54,"by":55,"text":56},{"id":94,"by":95,"text":96},[104],{"value":105,"source":64,"evidence":106},"Use TinyGo or LLVM directly instead of transpiling to C",[107,108],{"id":67,"by":68,"text":69},{"id":109,"by":110,"text":111},"48277687","vetrom","Well tinygo takes some go bindings they implemented for llvm, https:\u002F\u002Fgithub.com\u002Ftinygo-org\u002Fgo-llvm, uses the Go standard library for parsing, and wires it up to a LLVM IR…",[113],{"value":114,"source":64,"evidence":115},"Why not WebAssembly in the kernel?",[116],{"id":117,"by":118,"text":119},"48277520","7373737373","Noob question: why did they not choose to use WebAssembly in the kernel instead?",[121,132,140,147],{"value":122,"source":64,"evidence":123},"Aya (Rust)",[124,128],{"id":125,"by":126,"text":127},"48273260","tptacek","It's the same situation with Aya in Rust. It's sort of a \"same language on the backend and the frontend\" kind of deal, like with Javascript. I agree though, I think it makes more…",{"id":129,"by":130,"text":131},"48276399","tuetuopay","Nitpick: you definitely can do loops as long as the verifier can prove they're bounded. At my previous job, I've written production eBPF exclusively in Rust using Aya (mentioned…",{"value":133,"source":64,"evidence":134},"Writing plain C eBPF",[135,136],{"id":54,"by":55,"text":56},{"id":137,"by":138,"text":139},"48275873","brancz","We write quite a bit of BPF at work for the Parca-Agent project[1]. And we find that even C is sometimes too high level of a language paired with modern optimization techniques…",{"value":141,"source":64,"evidence":142},"Whistler (Common Lisp)",[143],{"id":144,"by":145,"text":146},"48273984","atgreen","Here's another option.. I created an optimizing eBPF compiler in Common Lisp for a lisp-ish DSL. It's nice because you can compile and load your eBPF code all in-process in lisp…",{"value":148,"source":64,"evidence":149},"Solod",[150],{"id":151,"by":152,"text":153},"48284016","jamesog","I'm curious if Solod https:\u002F\u002Fgithub.com\u002Fsolod-dev\u002Fsolod would be a good fit. It's not \"real\" Go, but you write Go and generate C.",{"comments":41,"answered":41,"key":155},[],{"commenters":157,"max_depth":158,"maker_replies":41,"first_comment_mins":159,"lifespan_hours":160},41,8,6084,125,[162,164,165,167,169,173,176,178,181,182,183,187,188,191,194,197,200,203,206,208,210,211,215,218,220,221,224,226,229,231,235,237,240,243,246,248,251,253,256,258,260,262,264,266,269,272,274,278,281,285,288,292,296,300,304],[54,41,37,163,55,41],"project\u002Fcritical\u002Fidea",[125,41,37,163,126,41],[129,41,41,166,130,41],"commenter\u002Fneutral\u002Fnone",[67,37,44,168,68,41],"project\u002Fneutral\u002Fidea",[170,37,41,171,172,41],"48273917","other\u002Fneutral\u002Fperformance","mickael-kerjean",[174,37,41,175,68,41],"48276316","commenter\u002Fneutral\u002Fperformance",[144,37,41,177,145,41],"other\u002Fneutral\u002Fnone",[179,37,41,166,180,41],"48278891","beanjuiceII",[109,37,44,168,110,41],[151,37,44,168,152,41],[184,31,37,185,186,41],"48278442","project\u002Fcritical\u002Fexecution","poly2it",[137,44,41,177,138,41],[189,44,41,177,190,41],"48276275","bjackman",[192,38,37,163,193,41],"48272414","sparrc",[195,38,41,166,196,41],"48272747","bluejekyll",[198,38,41,166,199,41],"48273299","Thaxll",[201,38,41,166,202,41],"48273321","lelanthran",[204,38,41,166,205,41],"48273672","itsnowandnever",[85,38,44,207,86,41],"project\u002Fmixed\u002Fidea",[81,38,32,209,82,41],"project\u002Fpositive\u002Fidea",[94,32,37,163,95,41],[212,213,41,177,214,41],"48278361",6,"farnulfo",[216,33,41,177,217,41],"48276599","MrClouds",[219,33,41,177,82,41],"48282693",[117,158,44,168,118,41],[222,158,41,177,223,41],"48279354","dwattttt",[225,158,41,177,126,41],"48279655",[227,158,41,177,228,41],"48280311","paul_knox",[230,158,41,177,82,41],"48282578",[232,233,41,177,234,41],"48272449",9,"a1o",[236,233,41,177,68,41],"48272489",[238,233,41,177,239,41],"48272499","all2",[241,233,41,177,242,41],"48272553","auxiliarymoose",[244,233,41,177,245,41],"48272602","aeonik",[247,233,41,177,223,41],"48279431",[249,233,41,177,250,41],"48285641","backprop1989",[252,233,41,177,223,41],"48286508",[254,233,41,255,68,41],"48272624","other\u002Fneutral\u002Fdocs",[257,233,41,255,242,41],"48272684",[259,233,41,177,68,41],"48272724",[261,233,41,177,242,41],"48272757",[263,233,41,166,68,41],"48272810",[265,233,41,166,242,41],"48272837",[267,233,41,177,268,41],"48276909","rounce",[270,233,41,177,271,41],"48272644","ImJasonH",[273,233,41,177,242,41],"48272700",[275,233,37,276,277,41],"48272833","project\u002Fcritical\u002Fdocs","Retr0id",[279,233,41,177,280,41],"48272729","knome",[282,283,44,168,284,41],"48272391",10,"shirleyquirk",[286,283,41,166,287,41],"48272605","abtinf",[289,290,37,276,291,41],"48273273",11,"i2km",[293,294,41,177,295,41],"48275218",12,"r3tr0",[297,294,44,298,299,41],"48276041","project\u002Fmixed\u002Fdesign","bflesch",[301,302,41,177,303,41],"48278529",13,"49north",[305,18,32,306,307,41],"48273333","project\u002Fpositive\u002Fexecution","hbwang2076",[],[310,315,320,325,329,333],{"id":311,"name":312,"points":313,"category":314},"48258015","Audiomass",553,"creative",{"id":316,"name":317,"points":318,"category":319},"48223362","Freenet",390,"infrastructure",{"id":321,"name":322,"points":323,"category":324},"48221896","I Dedicated 4 Years to Mastering Offline Password Cracking",268,"learning_science",{"id":326,"name":327,"points":328,"category":20},"48219918","Rmux",194,{"id":330,"name":331,"points":332,"category":20},"48234287","ShadowCat",168,{"id":334,"name":335,"points":336,"category":337},"48295071","TinyCld",111,"productivity",false,"v2",{"id":341,"name":5,"line":6,"ai":338,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":342,"maker":11,"domain":10,"tier":19,"attempts":41,"strip":343,"url":9,"mix":344,"praise":78,"objection":90,"sub":21},48225338,[24,25,26,27],"1130003100100351003000000000000000130135",[31,32,31,33],1794036701417]