Anything LiveCode Can Learn From GO
Rick Harrison
harrison at all-auctions.com
Sun Jun 10 10:27:53 EDT 2018
Hi Sannyasin,
I found a quick small snippet of some “Hello World” GO code and have listed it below.
I much prefer LiveCode syntax over this stuff any day.
Stick with LiveCode, it’s just better!
Just my 2 cents for the day.
Cheers,
Rick
Add a test to the stringutil package by creating the file$GOPATH/src/github.com/user/stringutil/reverse_test.go containing the following Go code.
package stringutil
import "testing"
func TestReverse(t *testing.T) {
cases := []struct {
in, want string
}{
{"Hello, world", "dlrow ,olleH"},
{"Hello, 世界", "界世 ,olleH"},
{"", ""},
}
for _, c := range cases {
got := Reverse(c.in)
if got != c.want {
t.Errorf("Reverse(%q) == %q, want %q", c.in, got, c.want)
}
}
}
Then run the test with go test:
$ go test github.com/user/stringutil
ok github.com/user/stringutil 0.165s
> On Jun 9, 2018, at 10:55 PM, Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> https://medium.com/exploring-code/why-should-you-learn-go-f607681fad65
>
> BR
More information about the use-livecode
mailing list