How to add GO support to Geany
I am trying to make syntax hightlighting and building options work for Geany, and advice? ...
I am trying to make syntax hightlighting and building options work for Geany, and advice? ...
Isn't this Golang program supposed to output a directory listing to stdout? It compiles ok, but does nothing. package main import "exec" func main() { argv := []string{"-la"} envv := []string{} exec.Run("ls", argv, envv, "", exec.DevNull, exec.PassThrough, exec.MergeWithStdout) } ...
I've started programming in Google's Go Language, and the package I'm attempting to write is an API for processing and creating DOCX files (I'm familiar with this topic and thought it would be a good way to learn Go). As DOCX files are primarly a ZIP file with various XML files inside them, I rather need a DOM XML parser. However, I was ...
Who is using Go? Is it being used commercially or academically and if so, where? ...
This problem is pretty common: an object should notify all its subscribers when some event occurs. In C++ we may use boost::signals or something else. But how to do this in Go language? It would be nice to see some working code example where a couple of objects are subscribed to a publisher and process notifications. Thanks ...
How do I use the fmt.Scanf function in golang to get an integer input from the standard input ? If this can't be done using fmt.Scanf, what's the best way to read a single integer ? Thanks :) ...
I was trying to look for information about generic database drivers for Google's Go language, when I notice I have hard time to get any result. Go SQL returns nothing related to the Go language, and golang SQL only returns useful results from the mailing list (and not, say, from github). Is there any smarter way I can look for informat...
Hi! I've got two forms of struct declaration in the function scope. As far as I could see the bellow-listed snippet woks just fine. The question is what's the difference between the two declaration ways? Is that only a semantic question or there is something tricky under the covers? package main import "fmt" func main() { type Pe...
Hi! Dealing with go's funcs I discovered that can't force the compiler to control whether I pass a value or pointer-to-value argument when using 'generic' interface{} type. func f(o interface{}) { ... } The most obvious solution is to use the following modification: func f(o *interface{}) { ... } Although this is successfully compi...
The problem I've just faced is what to do in the following case: func printItems(header string, items []interface{}, fmtString string) { // ... } func main() { var iarr = []int{1, 2, 3} var farr = []float{1.0, 2.0, 3.0} printItems("Integer array:", iarr, "") printItems("Float array:", farr, "") } Go has no generics and does...
Lets compare c and go: Hello_world.c : #include<stdio.h> int main(){ printf("Hello world!"); } Hello_world.go: package main import "fmt" func main(){ fmt.Printf("Hello world!") } Compile both: $gcc Hello_world.c -o Hello_c $8g Hello_world.go -o Hello_go.8 $8l Hello_go.8 -o Hello_go and ... what is it? $ls -ls ... 5,4K ...
I played around with Go a bit shortly after it came out. There wasn't a profiler then; is there one now? ...
Say i have a data structure like this: type Foo struct { Bar []struct { FooBar string } } And i fill it such that Bar has 3 elements. Now, using the template library, how can i access say the 3rd element's FooBar in that slice? I have tried the following with no success: {Foo.Bar[2].FooBar} {Foo.Bar.2.FooBar} Now, i know th...
Hi, I have checked in several sites but couldn't find one, is there a GO book? Thanks. ...
Disclaimer: I've only played with GO for one day now, so there's a good chance I've missed a lot. Does anybody know why there is no real support for generics/templates/whatsInAName in GO? So there is a generic map, but that's supplied by the compiler, while a GO programmer can't write her own implementation. With all the talk about maki...
This following code (well, almost the same) counts page views under Linux allright, but counts them double under Windows. Can someone figure out why? package main import ( "fmt" "http" ) func main() { println("Running") http.HandleFunc("/", makeHomeHandler()) http.ListenAndServe(":8080", nil) } // this version compiles...
I have to execute this command with given username; in bash it'd be, $su devrim -c "touch miki" i guess, first i need to get the uid from the username and use setuid before doing ForkExec. can u advice? how do i do this ? (ps: i don't have the uid, only username) func exec(cmd *Command, async bool) os.Error { parts := strings.Fi...
Dear fellow go enthusiasts, I would need xslt support in a go program. As far as I know there will be no xslt library in the the near future and currently there is no binding to a xslt library in go. What is the FASTEST library on linux or cross platform to do 1) xslt 1.0 transformation 2) xslt 2.0 transformation ...
I wrote a program that uses ForkExec in Go. command := "/bin/su -c '/bin/ls -lh / >/tmp/sC0X3kASz7' joe" pid, err := os.ForkExec(command, []string{}, os.Environ(), "", []*os.File{nil, cmd.Stdout, cmd.Stderr}) if you execute that command on your shell, and do cat /tmp/sC0X3kASz7 you will see your files listed. however, ForkExec abov...
Channels combine communication—the exchange of a value—with synchronization—guaranteeing that two calculations (goroutines) are in a known state. How is it possible to use the channels in Google Go to perform the functionality of mutex? package main import "sync" var global int = 0 var m sync.Mutex func thread1(){ m.Lock() g...