Forwarded from logos the coder from down the street
if Linux so good why they didn't made Linux 2???
See, there Windows 11(eleven) not just one silly version...
See, there Windows 11(eleven) not just one silly version...
π1
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
i am literally shaking, my hands are shaking
π1
Frectonz
This thing is so close to working but the typecheck is failing, after i transform the try statement to a regular if statement. from this try c or string = ioutil.ReadFile(filename) to this content, err := ioutil.ReadFile(filename) if err != nil { varβ¦
So the syntax is not the same as the one i used last time, changed it up a bit to make things easier. Here is the current version, that's working.
so the
1. the error variable
2. the type of the return value (this is needed because go has this convention of returning the zero value of a type incase of an error)
so the above syntax gets expanded into the following
content, err := ioutil.ReadFile(filename)
try err or string
so the
try statement expects two values1. the error variable
2. the type of the return value (this is needed because go has this convention of returning the zero value of a type incase of an error)
so the above syntax gets expanded into the following
if err != nil {
return make([]string, 1)[0], err
}π4
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
I have ascended beyond the mortal plain.
And golang devs you are welcome.
And golang devs you are welcome.
Frectonz
So the syntax is not the same as the one i used last time, changed it up a bit to make things easier. Here is the current version, that's working. content, err := ioutil.ReadFile(filename) try err or string so the try statement expects two values 1. theβ¦
i really wish some of you all could run it and try it out, i am using nix to setup the environment. The readme has instructions to build it from source, if you use nix.
https://github.com/frectonz/better-go/
https://github.com/frectonz/better-go/
GitHub
GitHub - frectonz/better-go: It's go but with try
It's go but with try. Contribute to frectonz/better-go development by creating an account on GitHub.
π8
Frectonz
a story of pain
This is what watching Jonathan Blow clips telling you to do hard stuff does to a person. π
π1
Frectonz
I fucken did it. It works, I added a try statement to the go compiler
Also implemented an
from this
to this
unwrap statement that panics when the error is not nil.from this
unwrap err
to this
if err != nil {
panic(err)
}π8
"Most people die at 25... we just don't bury them until they are 70."
β Benjamin Franklin
β Benjamin Franklin
π13