Closed vidhanio closed 2 years ago
Ok, nvm this is not ready to push. Weird nil pointer dereference error trying to retrieve languages from this wrapper...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1051e9b68]
goroutine 1 [running]:
github.com/milindmadhukar/go-piston.(*Client).GetLanguages(0x1400011dbf0)
/Users/vidhanio/go/pkg/mod/github.com/milindmadhukar/go-piston@v0.0.0-20211122120254-64da61081d05/piston.go:58 +0x48
main.GetLanguages()
/Users/vidhanio/Projects/CodeRunnerBot/exec.go:30 +0x5c
main.init()
/Users/vidhanio/Projects/CodeRunnerBot/bot.go:156 +0x28
I'll take a look at this as well
Not really sure why they are required to be hard-coded.
I dont think there is a more efficient way to put the correct aliases in for markdown mappings.
This wrapper really is not very good, we could try writing one ourselves.
what does the wrapper return?
I agree, this wrapper is poorly written... You could just take PISTON_URL
and append /runtimes
and do a GET request then marshal it to a struct with json flag thingies.
Nvm, this wrapper rocks.
I used the aliases you get from the runtimes to generate the language mappings instead, and no more hardcoding required! 🚀
Yup seemed like before you were just using the wrong api call.
I was using GetLanguages()
correctly, but ig that method is kinda not working properly. GetRuntimes()
works fine however, so this works for me.
GetLanguages()
just seems to return a list of languages that it supports, GetRuntimes()
returns the full struct.
Yeah, I guess so.
Looks good @Nathan13888?
🚀🚀🚀🚀
Closes #4.
Unfortunately not possible (?) for the mappings as they require hardcoded values which I have retrieved from pygments.
If either @wozeparrot or @Nathan13888 figure out a way to do this, please lmk :)