[{"data":1,"prerenderedAt":354},["ShallowReactive",2],{"project-45717724":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":27,"sentiment":28,"stance_mix":29,"scored_comments":34,"aspects":35,"strip":44,"post_text":47,"what":48,"said":76,"maker_in_thread":188,"shape":191,"grid":195,"attempts":316,"same_week":317,"maker_shows":38,"maker_hidden":346,"reader_version":347,"card":348},"45717724","vite-plugin-use-golang","Write Go code in JavaScript files","title","Show HN: Write Go code in JavaScript files","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fvite-plugin-use-golang","npmjs.com","yar-kravtsov",1761543373,2025,158,47,452,3837,12,"notable","dev_tools","vite plugin","library",[21,24,25,26],"golang webassembly","go in javascript","tinygo","debated",-0.071,{"positive":30,"neutral":31,"mixed":32,"critical":33},6,7,1,10,24,{"design":36,"performance":39,"execution":41,"idea":42,"docs":43},{"positive":37,"critical":38},0,2,{"positive":37,"critical":40},4,{"positive":32,"critical":37},{"positive":40,"critical":40},{"positive":32,"critical":37},[45,37,37,37,37,32,32,46,45,46,45,32,37,32,37,37,37,45,32,32,32,46,32,37,37,45,45,37,37,37,37,46,45,37,37,37,46,46,32,37],3,5,"I built a Vite plugin that lets you write Go code directly in .js files using a \"use   golang\" directive. It compiles to WebAssembly automatically.",{"problem":49,"audience":49,"pricing":49,"motivation":50,"time_to_build":49,"stack":57,"openness":75,"stage":75,"team_size":75},null,{"value":51,"source":52,"evidence":53},"Built as a joke in response to a tweet, to prototype a fun idea","maker",[54],{"id":55,"by":11,"text":56},"45718428","Fair take! Though, this was literally built as a joke in response to @ibuildthecloud's tweet. Sometimes the dumbest ideas are the most fun to prototype.",[58,63,67,71],{"value":59,"source":52,"evidence":60},"Go",[61],{"id":62},"post",{"value":64,"source":52,"evidence":65},"JavaScript",[66],{"id":62},{"value":68,"source":52,"evidence":69},"Vite",[70],{"id":62},{"value":72,"source":52,"evidence":73},"WebAssembly",[74],{"id":62},"unknown",{"praise":77,"objections":94,"requests":135,"questions":151,"alternatives":166},[78],{"value":79,"source":80,"evidence":81},"Fun and clever hack; good docs on when to use it","commenter",[82,86,90],{"id":83,"by":84,"text":85},"45718335","hshdhdhehd","Like it. Especially the how to use it and when to use it guidance.",{"id":87,"by":88,"text":89},"45721437","chamomeal","Unironically a really cool use of wasm. Might use this on my personal site lmao",{"id":91,"by":92,"text":93},"45718496","smashah","funny but this is going to become extremely popular.",[95,110,128],{"value":96,"source":80,"evidence":97},"Writing Go inside .js files is unidiomatic; importing .go files is preferred",[98,102,106],{"id":99,"by":100,"text":101},"45719084","tkzed49","Beautiful. Minor feedback: rather than having a \"use golang\" directive, just allow imports of .go files. This is more idiomatic for JS bundlers.",{"id":103,"by":104,"text":105},"45720828","halapro","Definitely not a minor feedback, there's no reason to write go in a .js file. Vite\u002Frollup are perfectly able to \"load\" certain file types and parse them however you like.",{"id":107,"by":108,"text":109},"45721171","CamouflagedKiwi","That would also avoid the problem with this syntax, that it's not a valid Go file (it doesn't start with `package ...` and I don't think a bare top-level string is valid), which…",{"value":111,"source":80,"evidence":112},"Browser WASM rarely beats JavaScript or WebGPU for performance",[113,117,120,124],{"id":114,"by":115,"text":116},"45718527","pjmlp","Cool hack, just use JavaScript.",{"id":118,"by":115,"text":119},"45718843","WebGPU or WebGL is the answer.",{"id":121,"by":122,"text":123},"45718863","hollowturtle","Better performance? For javascript code that calls into native platform apis provided by the browser it's been alteady proven that performance is an order of magnitude better…",{"id":125,"by":126,"text":127},"45723621","kypro","I was playing around with WASM and WebGL a few years ago to see if it could be used to increase JS performance on certain computationally heavy tasks. I might be misremembering…",{"value":129,"source":80,"evidence":130},"Backend-style code in the frontend risks business logic leaking to the client",[131],{"id":132,"by":133,"text":134},"45719276","liampulles","Just be careful with this backend-code-in-frontend stuff. If it's needed for some computationally expensive logic that is logically client side, then fine. But be wary of letting…",[136,144],{"value":137,"source":80,"evidence":138},"Allow importing .go files instead of the use golang directive",[139,140],{"id":99,"by":100,"text":101},{"id":141,"by":142,"text":143},"45721708","ivanjermakov","I would rather instantiate wasm module myself and have a build step to compile .go file. This way both JS and Go tooling would work.",{"value":145,"source":80,"evidence":146},"Support for Julia or scientific computing use cases",[147],{"id":148,"by":149,"text":150},"45725290","Imustaskforhelp","> Scientific computing where you already have Go code This is a really cool project and I must admit that and I am on the side as well also asking for something similar to your…",[152,159],{"value":153,"source":80,"evidence":154},"How big is the WASM bundle compared to imagemagick wasm?",[155],{"id":156,"by":157,"text":158},"45718833","h33t-l4x0r","How big is it? Is it smaller than imagemagick wasm?",{"value":160,"source":80,"evidence":161},"Does it run only on the backend?",[162],{"id":163,"by":164,"text":165},"45720841","lisbbb","I'm guessing this only works on back end? If yes, then why not just write the back end in Go if you're so fond of the language? It's not like Golang lacks the libraries to do web…",[167,174,181],{"value":168,"source":80,"evidence":169},"Importing .go files via tinygo WASM builds",[170],{"id":171,"by":172,"text":173},"45719106","zikani_03","Looks interesting and good use case for introducing folks to extending web apps with WASM functionality. Used a similar technique using tinygo wasm builds (without Vite ofcourse)…",{"value":175,"source":80,"evidence":176},"Browser WebGPU or WebGL for compute",[177,178],{"id":118,"by":115,"text":119},{"id":179,"by":115,"text":180},"45718847","You can take advantage of that power via WebGPU, or WebGL if the browser is not yet up to it.",{"value":182,"source":80,"evidence":183},"polyglot-tag",[184],{"id":185,"by":186,"text":187},"45718429","foreigner","Reminds me of this toy I made some years ago: https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fpolyglot-tag",{"comments":32,"answered":37,"key":189},[190],{"id":55,"text":56},{"commenters":192,"max_depth":31,"maker_replies":32,"first_comment_mins":193,"lifespan_hours":194},37,130,41,[196,198,202,204,208,211,213,217,219,221,223,225,226,229,231,234,237,240,242,245,248,252,253,256,257,260,262,264,267,269,273,275,277,280,282,284,287,289,291,295,297,300,303,305,307,311,313],[99,37,45,197,100,37],"maker\u002Fmixed\u002Fdesign",[199,37,37,200,201,37],"45720617","commenter\u002Fneutral\u002Fnone","whizzter",[103,37,37,203,104,37],"commenter\u002Fcritical\u002Fdesign",[205,37,37,206,207,37],"45726093","commenter\u002Fneutral\u002Fidea","joshribakoff",[209,37,37,210,104,37],"45729529","commenter\u002Fcritical\u002Fidea",[107,37,32,212,108,37],"project\u002Fcritical\u002Fdesign",[214,32,37,215,216,37],"45718495","other\u002Fneutral\u002Fnone","b_e_n_t_o_n",[125,38,32,218,126,37],"project\u002Fcritical\u002Fperformance",[148,45,46,220,149,37],"project\u002Fpositive\u002Fexecution",[185,40,45,222,186,37],"project\u002Fneutral\u002Fidea",[171,46,46,224,172,37],"project\u002Fpositive\u002Fidea",[163,30,45,222,164,37],[227,30,45,222,228,37],"45721139","phpdave11",[114,31,32,230,115,37],"project\u002Fcritical\u002Fidea",[232,31,37,206,233,37],"45718573","kitd",[235,31,32,230,236,37],"45718644","onion2k",[238,31,37,210,239,37],"45718737","tgv",[179,31,37,241,115,37],"commenter\u002Fneutral\u002Fperformance",[243,31,37,206,244,37],"45718926","preommr",[246,31,37,200,247,37],"45719930","chrisweekly",[249,31,45,250,251,37],"45718617","project\u002Fneutral\u002Fperformance","Cthulhu_",[118,31,32,218,115,37],[254,31,32,218,255,37],"45720060","dgb23",[121,31,32,218,122,37],[258,31,46,224,259,37],"45720349","ramses0",[141,261,32,212,142,37],8,[132,263,32,230,133,37],9,[265,263,37,206,266,37],"45720892","nesarkvechnep",[268,263,37,206,133,37],"45740465",[270,263,45,271,272,37],"45721373","project\u002Fneutral\u002Fdocs","rs186",[274,263,45,222,100,37],"45724829",[276,263,37,206,133,37],"45725113",[278,263,37,210,279,37],"45730257","solumunus",[281,263,37,200,133,37],"45731481",[283,263,37,200,279,37],"45735242",[285,263,37,286,133,37],"45740412","other\u002Fcritical\u002Fidea",[83,33,46,288,84,37],"project\u002Fpositive\u002Fdocs",[156,290,45,250,157,37],11,[292,290,37,293,294,37],"45719597","other\u002Fneutral\u002Fperformance","foofoo12",[296,290,37,293,157,37],"45730081",[298,18,37,215,299,37],"45718871","montakaoh",[301,18,37,215,302,37],"45723284","dlock17",[91,304,46,224,92,37],13,[87,306,46,224,88,37],14,[308,309,32,230,310,37],"45718394",15,"nsonha",[55,309,37,312,11,32],"maker\u002Fneutral\u002Fidea",[314,309,37,215,315,37],"45718562","iamsaitam",[],[318,322,327,332,337,341],{"id":319,"name":320,"points":321,"category":20},"45706792","oxdraw",266,{"id":323,"name":324,"points":325,"category":326},"45715055","MyraOS",247,"infrastructure",{"id":328,"name":329,"points":330,"category":331},"45731366","Bash Screensavers",246,"creative",{"id":333,"name":334,"points":335,"category":336},"45684689","Deadstack",188,"productivity",{"id":338,"name":339,"points":340,"category":331},"45721352","ISS in Real Time",165,{"id":342,"name":343,"points":344,"category":345},"45722826","JSON Query",154,"data",false,"v2",{"id":349,"name":5,"line":6,"ai":346,"cat":20,"year":13,"points":14,"comments":15,"rec":27,"s":350,"top":18,"kw":351,"maker":11,"domain":10,"tier":19,"attempts":37,"strip":352,"url":9,"mix":353,"praise":79,"objection":96,"sub":21},45717724,-0.07,[21,24,25,26],"3000011535310100031115100330000530005510",[30,31,32,33],1793991132942]