Re: [go-nuts] What's the recommended way to determine if a type.Type is exported?

2017-04-23 Thread 'Axel Wagner' via golang-nuts
I'd say, probably type-asserting to a *types.TypeName and then use Exported() (the code of which also leads to ast.IsExported ). Side-note: You probably shoul

[go-nuts] What's the recommended way to determine if a type.Type is exported?

2017-04-23 Thread me
https://golang.org/pkg/go/types/#Type Is there a helper function to determine whether a *types.Type* is exported? It seems like I can do some string parsing like t := something.Type() parts := strings.Split(t.String(), ".") // go/ast.Node => ["go/ast", "Node"] ident := parts[len(parts)-1] // "No

Re: [go-nuts] Re: Is everything passed as a value in Go?

2017-04-23 Thread st ov
Thank you for explicitly listing all reference semantics and more importantly the considerations given for their use! On Saturday, April 22, 2017 at 8:41:22 AM UTC-7, Konstantin Khomoutov wrote: > > On Tue, 18 Apr 2017 14:30:29 -0700 (PDT) > st ov > wrote: > > > Wow! Thanks everyone! > > >

Re: [go-nuts] 1.9 roadmap will include 12750-localization.md ?

2017-04-23 Thread mhhcbon
Thanks, clear. Well not so clear about /x/ packages. I suspect it is free wheel and disconnected from go releases. On Sunday, April 23, 2017 at 5:32:56 PM UTC+2, Ian Lance Taylor wrote: > > On Sun, Apr 23, 2017 at 2:10 AM, > wrote: > > > > About the roadmap of 1.9 (this one > https://github.

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Michael Jones
...or if you copy the strings.Contains() comparison to the test, it echoes the program with six and each of the patterns removed. On Sun, Apr 23, 2017 at 7:57 AM, Michael Jones wrote: > Another example: > https://play.golang.org/p/hDKQtwHo6M > > In this case, just copy the program to your machin

Re: [go-nuts] 1.9 roadmap will include 12750-localization.md ?

2017-04-23 Thread Ian Lance Taylor
On Sun, Apr 23, 2017 at 2:10 AM, wrote: > > About the roadmap of 1.9 (this one https://github.com/golang/go/milestone/49 > ?) > I can t find information about this proposal. > > But i see some changes about it in checkins. > > Will it be included in 1.9 ? > Is there a formal document to introduce

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Michael Jones
Another example: https://play.golang.org/p/hDKQtwHo6M In this case, just copy the program to your machine and build it. i called it lines.go when i run it as: lines < lines.go it echos the program with the line "six" removed On Sun, Apr 23, 2017 at 12:47 AM, Ishan Jain wrote: > You can do it

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Ishan Jain
I created a small program to demonstrate this. As go playground doees not supports files and stuff so I put all the content of file in an array and iterated through that. You can read the file and iterate through ReadBuffer Line by line to get the same results. Go playground link: https://play

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Ishan Jain
You can do it like this. I wrote the code to filter out lines from an array that does not contain words specified in array. package main > > import ( >"os" >"log" >"bufio" >"io" >"regexp" > ) > > var abcd = [5]string{ >"one two", >"three four fix", >"six", >"s

Re: [go-nuts] Re: Turning unicode code string to rune

2017-04-23 Thread Tong Sun
Thanks a lot Ivan! FTR: https://play.golang.org/p/tYfn9L12vD and also, https://github.com/suntong/lang/blob/master/lang/Go/src/text/Rune.go On Sat, Apr 22, 2017 at 10:42 PM, Ivan Kurnosov wrote: > 1. Convert it to a number > 2. Use `rune()` > > > On Sunday, April 23, 2017 at 6:51:09 AM UTC+12,

Re: [go-nuts] Find a string in a file and delete all occurences in the file

2017-04-23 Thread Konstantin Khomoutov
On Sat, 22 Apr 2017 08:08:57 -0700 (PDT) Vikas Kumar wrote: > I am trying to iterate over an array, match the lines in a file and > then delete all occurrences of the lines in the file. > > See this example. > *Array* > var abcd = [5]string{ > "one two", > "three four fix", > "six",

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Vikas Kumar
Thanks Tamás, I am looking something in a Golang way so that I can create a binary and distribute it in the team which has some Windows users as well. Thanks for the pointers. Let me try it out. On Sunday, 23 April 2017 17:06:42 UTC+10, Tamás Gulácsi wrote: > > The easiest would be that sed. >

[go-nuts] 1.9 roadmap will include 12750-localization.md ?

2017-04-23 Thread mhhcbon
Hi, About the roadmap of 1.9 (this one https://github.com/golang/go/milestone/49 ?) I can t find information about this proposal. But i see some changes about it in checkins. Will it be included in 1.9 ? Is there a formal document to introduce the next roadmap ? I mean something that goes beyo

Re: [go-nuts] Re: `go tool trace` blank page (404 + Uncaught ReferenceError: tr is not defined)

2017-04-23 Thread Pierre Neidhardt
https://golang.org/doc/install/source does not document the folder hierarchy, nor could I find it documented elsewhere. Shouldn't we document the purpose of folders such as 'misc/'? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Which benchmark case is the reliable one?

2017-04-23 Thread Dave Cheney
-gcflags=-m will help confirm this l. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://gr

[go-nuts] Find a string in a file and delete all occurences in the file

2017-04-23 Thread Tamás Gulácsi
The easiest would be that sed. Otherwise, do as sed: iterate through the lines with a bufio.Scanner, and write out libes into a bytes.Buffer iff it doesn't match. At the end, overwrite the file with buf.Bytes using ioutil.WriteFile. -- You received this message because you are subscribed to the