Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-10 Thread Jan Mercl
On Mon, Jul 10, 2017 at 2:24 PM T L wrote: > Aha, what I wanted to express is the execution orders of the two lines may be randomized. > > atomic.AddInt32(, 1) > atomic.AddInt32(, 1) No, assuming those two lines are as written, ie. part of single function and thus executed

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-09 Thread Jan Mercl
On Sun, Jul 9, 2017 at 10:56 AM T L wrote: > But I remember that the "happens-before relationship" is never written down in any official Go documentation. https://golang.org/ref/mem#tmp_2 -- -j -- You received this message because you are subscribed to the Google

Re: [go-nuts] Re: Random Number Generation in a given range

2017-07-10 Thread Jan Mercl
On Mon, Jul 10, 2017 at 4:41 PM Alok Kumar Singh wrote: > in my usecasei use this to generate random slice everytime > dont want the same result > using it to test my algos For that you need one only call to Seed at init(). -- -j -- You received this message because

Re: [go-nuts] Sorting user defined collection in multiple ways

2017-07-21 Thread Jan Mercl
On Fri, Jul 21, 2017 at 3:17 PM wrote: > - I have user defined data structure called Employee with attributes "age", name and sal. I want to write three different go functions that sorts based on age, name and sal. Are you sorting a slice?

Re: [go-nuts] GoDoc: ignore GOPATH, local serving of help files

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:33 PM me wrote: > $ GOPATH= godoc -http :6060 & -- -j -- 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

Re: [go-nuts] Bitwise operators applications

2017-07-23 Thread Jan Mercl
On Sun, Jul 23, 2017 at 5:36 AM Alexey Dvoretskiy wrote: > The question is what are practical applications of bitwise operations in Go and when I should use/learn them? Evolution clearly figured out the advantage of repeating fylogenesis in ontogenesis. Programmers

Re: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread Jan Mercl
On Sun, Jul 23, 2017 at 7:26 PM John Souvestre wrote: > I believe that the result is the least significant bit, not byte. Does not look like that: https://play.golang.org/p/thzUaazLSp -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Why default stack size is 1gb?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:32 PM taozle wrote: > I found that the default stack size for 64-bit is 1gb, but i can't see any reason for such a large stack, can anyone help me find out the purpose for this? Where did you find that info? AFAICT it's not true. Thread stack

Re: [go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:32 PM il wrote: > Can you help me best solution? Create a perfect hash function in 28 bits. Use a [1<<28]T array for the map values. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 11:28 AM <370265...@qq.com> wrote: I think I can see at least one data race in your code. Try to run it using the race detector to verify. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Why default stack size is 1gb?

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 4:26 PM T L wrote: > BTW, I think we do need a GrowCurrentStackTo API, to avoid predicted several stack copies in stack growing. The specification does not requires Go implementations to have any stack at all. -- -j -- You received this message

Re: [go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 6:37 PM Julian Andres Klode wrote: > Is there an existing alternative to reflect.DeepEqual() that also respects the shape of the arguments? For example, the following tests fail: a and b _are_ of equal shape and contain equal values:

Re: [go-nuts] go get awkwardness with packages outside of GOPATH

2017-07-19 Thread Jan Mercl
On Wed, Jul 19, 2017 at 8:45 PM 'Florian Uekermann' via golang-nuts < golang-nuts@googlegroups.com> wrote: > tldr: Please let me update dependencies of packages that are in arbitrary directories. Dependencies are derived from import paths. Import paths are not complete paths. They are

Re: [go-nuts] Expiring map

2017-07-19 Thread Jan Mercl
On Wed, Jul 19, 2017 at 9:22 PM Rajanikanth Jammalamadaka < rajanika...@gmail.com> wrote: > Does somebody have a recommendation for an expiring dict? If I have to write my own, is there a way to avoid iterating over all the keys to delete the expired entries? Common approach is to tag the

[go-nuts] Re: Pointer dereference operator precedence

2017-07-19 Thread Jan Mercl
Consider var x *[N]*T What is the type of *x[0]? *T or T? Only the parentheses can disambiguate it: (*x)[0] vs *(x[0]). On Thu, Jul 20, 2017, 00:28 wrote: > A question on Stack Overflow led me to carefully examine the spec and I > feel like there may be some detail

Re: [go-nuts] Understanding least significant byte operation

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 12:25 AM John Souvestre wrote: > That looks like the least significant set bit to me. To me too ;-) But I was responding to your > On Sun, Jul 23, 2017 at 7:26 PM John Souvestre wrote: > >> I believe that the result is the least

Re: [go-nuts] why rot13Reader example run twice?

2017-06-30 Thread Jan Mercl
On Fri, Jun 30, 2017 at 9:48 AM Franco Marchesini < franco.marches...@gmail.com> wrote: > Why after the execution the k value is 2? What value of k do you expect instead and why? ( https://play.golang.org/p/wdWo3fahAS) -- -j -- You received this message because you are subscribed to the

Re: [go-nuts] why rot13Reader example run twice?

2017-06-30 Thread Jan Mercl
On Fri, Jun 30, 2017 at 2:42 PM Franco Marchesini < franco.marches...@gmail.com> wrote: > Aside from the correction, however, I did not understand why the method is called 2 times. HTH: https://play.golang.org/p/Na7GtgZ-_B -- -j -- You received this message because you are subscribed to

Re: [go-nuts] No luck running 'go install' from within go program

2017-07-01 Thread Jan Mercl
On Sat, Jul 1, 2017 at 5:12 AM wrote: > and the golang version is go_project.go cmd = exec.Command("go install -x")

Re: [go-nuts] How to access pointer to pointer in cgo

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 1:04 PM Manohar Reddy wrote: > fmt.Println(optional._32.Magic) // did not work for me: HOW TO ACCESS MAGIC VARIABLE Who wants to guess what does "did not work for me" mean without having the source code and the compiler output to look at? Please post

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 11:03 AM Darren Hoo wrote: > what is the relation between `type literal` and `named type`, Orthogonality. > aren't they mutually exclusive? No. Otherwise `type T U` would be illegal. -- -j -- You received this message because you are

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 11:39 AM Darren Hoo wrote: > In https://talks.golang.org/2015/tricks.slide#5 says int is type literal, then you say int is named type. > > How can int be both type literal and named type while they are orthogonal? A type literal can be a named type

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 11:03 AM Darren Hoo wrote: >>> what is the relation between `type literal` and `named type`, >> >> Orthogonality. > > Then `int` is not named type. Please explain why do you think so. I don't get it. > `int` and `int64` are not the same in this

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 9:17 AM Darren Hoo wrote: > f1's type is func(int), and f2's type is main.f, they are different types, does implicit conversion happen here? It's not a conversion. The rule is about assignability : "x's type

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 10:33 AM Darren Hoo wrote: > So in https://talks.golang.org/2015/tricks.slide#5 > > Other examples of type literals are int and []string, > > is actually not correct. The text is completely correct. Type literal is like a type expression. To

Re: [go-nuts] question about func type

2017-07-05 Thread Jan Mercl
On Wed, Jul 5, 2017 at 9:54 AM Darren Hoo wrote: > which part did I misunderstand? 'u' and 'int64' are both named types. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Capture test output per-function

2017-07-06 Thread Jan Mercl
On Thu, Jul 6, 2017 at 12:56 AM wrote: > As far as I can tell, go test captures the output per-package, and when one test fails it dumps all the captured logs. It's per test, not package. jnml@r550:~/tmp/test$ ls all_test.go jnml@r550:~/tmp/test$ cat all_test.go

Re: [go-nuts] bytes.Buffer WriteAt

2017-04-26 Thread Jan Mercl
On Wed, Apr 26, 2017 at 11:21 AM Chris Hopkins wrote: > However I cannot find anyone else having written something similar. FWIW, a [memory] cache with file os.File-like interface:

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Jan Mercl
On Wed, Apr 26, 2017 at 11:58 AM roger peppe wrote: > FWIW I have seen real problems in production where long-running worker goroutines stopped working. We looked into it and found that certain rare requests were panicking, not releasing a mutex and thus preventing the

Re: [go-nuts] Recover considered harmful

2017-04-24 Thread Jan Mercl
On Mon, Apr 24, 2017 at 3:19 PM Sokolov Yura wrote: > And what about unrecoverable panic? C-style `assert`? fmt.Fprintf(os.Stderr, "it's full of stars!\n") os.Exit(1) -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] https://go-proverbs.github.io/ what do you think of this one ?

2017-04-24 Thread Jan Mercl
On Mon, Apr 24, 2017 at 4:39 PM wrote: > Any thoughts? Yes. In the second version there is something that can be withdrawn. The special case of handling an error value, which is just an interface value like many other interface values. Getting rid of that special case and the

Re: [go-nuts] Re: No Allman-Style, No go!

2017-07-29 Thread Jan Mercl
On Sat, Jul 29, 2017 at 7:36 PM wrote: > But as Gofmt can ALREADY enforces this common coding style, and can be run at any time, including before committing code on the depots, why should it be enforced by the COMPILER too ? Let me pick just one misconception. The

Re: [go-nuts] A humble request/challenge

2017-08-08 Thread Jan Mercl
On Wed, Aug 9, 2017 at 12:32 AM Pierpaolo Bernardi wrote: > Downloading the paper requires a scribd account which costs money(*). > Is the paper available for free somewhere else? My 2-minute skimming smells quite crackpot-ish

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread Jan Mercl
On Tue, Aug 8, 2017 at 9:06 AM wrote: > Sort.Search is nice, but then the list has to be sorted. Then it's a simple for range loop. > So why not come up with > > func findFirst(slice interface{}, matches func(i int ) bool

Re: [go-nuts] Slice capacity changes

2017-08-09 Thread Jan Mercl
On Wed, Aug 9, 2017 at 2:56 AM sno wrote: > In the above code, the capacity prints 32. However, if you comment the first print statement and remove the commenting on the second and run the program again the capacity will only be 8. What is happening with

Re: [go-nuts] "fallthrough statement out of place" in `if` block inside `swicth` block

2017-08-01 Thread Jan Mercl
On Tue, Aug 1, 2017 at 2:34 PM Fumi Takeuchi wrote: > Example code: https://play.golang.org/p/dVtPVt3oKt > > Maybe `fallthrough` statement cannot be used in `if` block even if it's put inside `swicth` block) True: It may be used only as the final non-empty statement in

Re: [go-nuts] Get a copy of reflect.Value's underlying value

2017-08-01 Thread Jan Mercl
On Tue, Aug 1, 2017 at 2:58 PM Josh Humphries wrote: > Using an interface, the value will be inlined instead of heap-allocated if it fits without boxing (so most primitive types and pointer types won't need heap allocation). This was true some years ago, but it is no

Re: [go-nuts] Re: Generics are overrated.

2017-08-08 Thread Jan Mercl
On Tue, Aug 8, 2017 at 1:37 PM Haddock wrote: > Currently Java developers would not change to Go. Never enough of good news. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] [Go2] append

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 9:23 PM Gert wrote: > Can append or the compiler be made to prevent or warn for bugs like this? No. Slice is a value and append accepts s not as its first argument. That means the new slice value need be returned for code that uses the resulting

Re: [go-nuts] [Go2] append

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 9:52 PM Gert wrote: > Exactly, pretty sure some day if Go get used in a power plant or something we will have a outage for bugs like this that fly under the radar so easily passing all tooling, error checks and probably unit tests too :) Detecting

Re: [go-nuts] Re: No Allman-Style, No go!

2017-07-27 Thread Jan Mercl
On Thu, Jul 27, 2017 at 10:39 PM Michael Jones wrote: > Ecstatic, ... Excellent post! Isn't it strange, that we, programmers, well used to model the problem once in term of CPU registers and raw memory, then in a pure functional style and then again in some imperative

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 4:23 PM wrote: > 2) find(sliceB, item_i_look_for) int, -1 for not found See https://golang.org/pkg/sort/#Search and friends -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Go 2 suggestion - Types like "int?"

2017-08-19 Thread Jan Mercl
On Sat, Aug 19, 2017 at 5:05 PM Tong Sun wrote: > Suggesting C# type syntax like "int?" so as to take nil as valid value. - As int is not a pointer type, what would nil int mean? - Are you willing to sacrifice extra storage for the additional isNil information or do you

Re: [go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-22 Thread Jan Mercl
On Tue, Aug 22, 2017 at 3:33 PM roger peppe wrote: > I *think* that the current implementation was inspired by Minux's comment here: > https://groups.google.com/d/msg/golang-dev/G-uGL-jpOFw/vfazKS47_ckJ > > but I can't seem to find a comment from Russ that I seem to remember

Re: [go-nuts] Initializing Go Struct Literals

2017-08-22 Thread Jan Mercl
On Tue, Aug 22, 2017 at 4:38 PM Tong Sun wrote: https://play.golang.org/p/mKdRevvsH0 -- -j -- 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

Re: [go-nuts] why iota can't be assigned to variables?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 6:00 PM T L wrote: > Just like what expected for constants. For constants it's expected to reuse the last iota expression when absent. Do you propose that var ( a = iota b ) will become valid and

Re: [go-nuts] why iota can't be assigned to variables?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 4:38 PM T L wrote: > The request is not essential, but any harm of it? How can anybody know that if nobody knows what it shall actually do and what will be the impact on the complexity of the specification and implementation? -- -j -- You

Re: [go-nuts] why iota can't be assigned to variables?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 5:07 PM T L wrote: > The complexity is the same as iota in constant declarations. How can that be claimed when still nobody ever seen any specification of what var foo = iota shall do at all? The space of possible semantics is unbounded. The sane

Re: [go-nuts] why iota can't be assigned to variables?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 3:19 PM T L wrote: Why would you want to assign iota to a variable? What value should iota in such case have? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Re: Is there a way to fee a memory object on demand?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 4:24 PM Piotr Narewski wrote: > I've just tried it and unfortunately it doesn't seem to be better than the traditional approach. > > With the pool in place, it still user too much memory (unlike my solution with using a heap via glibc). Sorry to hear

Re: [go-nuts] Is there a way to fee a memory object on demand?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 3:14 PM Piotr Narewski wrote: > Wouldn't it require me to only use slices of a fixed size? No, the slice.Pool object has 63 sync.Pool objects: https://github.com/cznic/internal/blob/e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c/slice/pool.go#L95, ie. 63

Re: [go-nuts] Is there a way to fee a memory object on demand?

2017-05-02 Thread Jan Mercl
On Tue, May 2, 2017 at 8:35 PM Piotr Narewski wrote: > Does anyone know a way to do something like this (freeing memory on demand), but using pure Go? > Something that will compile (and work) on any platform, without any extra dependencies.. sync.Pool could be probably a

Re: [go-nuts] Re: Is there a way to fee a memory object on demand?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 6:50 PM Piotr Narewski wrote: > Perhaps that is the reason; when I need 515 bytes, it actually allocates 1024 > This might be when I'm loosing the mem. Not if you Put() it back after use ;-) It's of course also possible to make the allocation

Re: [go-nuts] Re: Is there a way to fee a memory object on demand?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 6:28 PM Piotr Narewski wrote: > I've checked it and I think there is something wrong with this lib. I haven't checked thoroughly, but it seems to be working as intended. If you Put(515) the correct bin to use is the one for sizes 257-512. If you

Re: [go-nuts] Re: Is there a way to fee a memory object on demand?

2017-05-03 Thread Jan Mercl
On Wed, May 3, 2017 at 6:39 PM Piotr Narewski wrote: > I am supposed to allocate the slice with "slice.Bytes.Get(515).(*[]byte)" not "make([]byte, 515)" Yes. Even better is p := slice.Bytes.Get(n) b := *p ... use b as usual, it's already a []byte.

Re: [go-nuts] accidental 'testing' import

2017-05-10 Thread Jan Mercl
On Wed, May 10, 2017 at 5:01 PM Brian Fallik wrote: > Or would this make sense as > an external tool, and does one already exist? Maybe grep of the output of 'go list' may be helpful: https://golang.org/cmd/go/#hdr-List_packages -- -j -- You received this message because

Re: [go-nuts] Golang map is getting corrupted with Memory mapped files

2017-05-17 Thread Jan Mercl
On Wed, May 17, 2017 at 2:49 PM chaitanya reddy wrote: Maps must be initialized before mutating them, which the program does not do. However, when initializing a map it's not possible to chose where the map instance will be allocated neither where the map will acquire

Re: [go-nuts] Are there any implicit type conversions in Go?

2017-05-13 Thread Jan Mercl
On Sat, May 13, 2017 at 8:19 PM st ov wrote: > Go appears to be very strict when using types. Even aliases need to be explicitly cast. > > Are there any contexts where types are implicitly cast? Or must all type conversions be specified? cast != conversion Otherwise for

Re: [go-nuts] why received can be defined with/without pointer?

2017-05-09 Thread Jan Mercl
On Tue, May 9, 2017 at 2:22 PM Volker Dobler wrote: > Go offers two types of methods, those > defined on value types and those defined on pointer types. To avoid possible confusion: It's not possible to attach methods to a pointer type. The receiver has form T or *T,

Re: [go-nuts] Re: {CGO,VM}-free SQLite (ATM Linux/Intel only, pre-alpha)

2017-06-09 Thread Jan Mercl
On Fri, Jun 9, 2017 at 5:01 AM David Anderson wrote: > It looks like it takes the sqlite3 source code (specifically, https://www.sqlite.org/amalgamation.html), mechanically translates it from C to Go using https://github.com/cznic/ccgo , then adds a thin layer to adapt the

Re: [go-nuts] How to include unused functions into binary

2017-06-21 Thread Jan Mercl
On Wed, Jun 21, 2017 at 2:44 PM wrote: > I read somewhere that Go will remove unused functions so that it wont be included into binaries when it can prove no code is using it. Correct. > However I am using reflection to call functions that are inside the binaries

Re: [go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-21 Thread Jan Mercl
On Wed, Jun 21, 2017 at 1:50 PM Ronald wrote: > for { > ct++ > if ct%6 == 0 { > t2 := time.Now().UnixNano() > fmt.Println("hooray", t2, t1, float64(t2-t1)/1e6) > t1 = t2 > } > } > This piece

Re: [go-nuts] Go get function improvements

2017-06-22 Thread Jan Mercl
On Thu, Jun 22, 2017 at 4:44 PM Vickey Rawat wrote: > GITHUB/GOTA > Now when i use go get github/gota github/gota does not look like a valid import path. If you mean this: jnml@mate1610-32:~$ echo $GOPATH /home/jnml jnml@mate1610-32:~$ rm -rf $GOPATH/src $GOPATH/pkg

Re: [go-nuts] Go get function improvements

2017-06-22 Thread Jan Mercl
Copy paste error eated jnml@mate1610-32:~$ go get -v github.com/kniren/gota/... -- -j -- 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

Re: [go-nuts] issues about struct align

2017-05-19 Thread Jan Mercl
On Fri, May 19, 2017 at 1:29 PM xjdrew wrote: > uint64 should aligin in 8 bytes, why it aligns in 4 bytes in go1.8.1.linux-386? https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86 > Could anyone tell me how I can get the same result

Re: [go-nuts] Problem with HINDI NAMES

2017-05-25 Thread Jan Mercl
On Thu, May 25, 2017 at 4:25 PM Vikram Rawat wrote: It's working as specified: https://play.golang.org/p/yviuaufGDQ -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] [ERROR] invalid argument when executing bufio.NewWriter.Flush()

2017-06-03 Thread Jan Mercl
On Sat, Jun 3, 2017 at 12:42 PM Harry wrote: > How can I handle to write something out using bufio.NewWriter? Just fine. The problem is you haven't created any file to write to in the first place, which checking the error could have told you. -- -j -- You received this

Re: [go-nuts] os.Args[0] for program executed by go

2017-06-01 Thread Jan Mercl
On Thu, Jun 1, 2017 at 7:41 PM Santhosh Ram Manohar wrote: > Args: []string{"self", "selftest"}, Here you explicitly pass arsg[0] == "self" and that's what the program gets. > What is the reason for this difference only for the binaries executed by the exec package ?

[go-nuts] {CGO,VM}-free SQLite (ATM Linux/Intel only, pre-alpha)

2017-06-05 Thread Jan Mercl
https://github.com/cznic/sqlite -- -j -- 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

Re: [go-nuts] understanding utf-8 for a newbie

2017-05-07 Thread Jan Mercl
On Sun, May 7, 2017 at 8:39 PM peterGo wrote: > "[Rob Pike and Ken Thompson] they made sure it was backwards compatible with ASCII." > ASCII is 7-bits. So is any UTF-8 encoded ASCII. -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Jan Mercl
On Thu, May 4, 2017 at 1:54 PM wrote: > Can you help me explain this behaviour? The universe scope is not a package. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] "%T" verb sometimes prints the name of the source file when passed an untyped constant

2017-05-04 Thread Jan Mercl
On Thu, May 4, 2017 at 2:22 PM Alberto Cortes wrote: > Can you elaborate on your answer? %T produces packageName.typeName, where 'packageName' is the name of the package where 'typeName' is defined. But the universe scope is not a package, hence no 'packageName.'. --

Re: [go-nuts] sort.SliceStable behaves incorrectly, but only sometimes!

2017-05-05 Thread Jan Mercl
On Fri, May 5, 2017 at 11:37 AM Ondřej Kupka wrote: > It seems that the slice is sometimes sorted properly and sometimes it isn't obviously sorted. How is that possible? Performing separate stable sorts on a partial key does not produce a stable sort on the full key. --

Re: [go-nuts] Possible optimization bug in go1.8?

2017-05-08 Thread Jan Mercl
On Mon, May 8, 2017 at 3:50 PM wrote: > Could it be a bug? No, the xrand function will always return the same number. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Is this a race detector false positive case

2017-09-15 Thread Jan Mercl
On Fri, Sep 15, 2017 at 3:15 PM wrote: https://stackoverflow.com/q/46233680 -- -j -- 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

Re: [go-nuts] Are you tired typing if err != nil {} ?

2017-09-14 Thread Jan Mercl
On Fri, Sep 15, 2017 at 2:32 AM Wojciech S. Czarnecki wrote: I code a lot in Go, but saving a couple of seconds/minutes when writing code which, including research, thinking, testing, debugging and documenting, takes hours or even months to develop makes no sense to me. Vim is

Re: [go-nuts] buffered io.ReaderAt

2017-09-16 Thread Jan Mercl
On Sat, Sep 16, 2017 at 1:52 PM Sebastien Binet wrote: > Has anybody written a buffered version of an io.ReaderAt ? IIUC what's needed, you might want to try https://github.com/cznic/file/blob/efffc965e97bbf31b0ed00deb82fe697500f22b5/file.go#L1039 -- -j -- You received

Re: [go-nuts] Going crazy on golang maps

2017-09-23 Thread Jan Mercl
On Sat, Sep 23, 2017 at 4:37 PM Chris Polderman wrote: > The full code reads: The full code is not full code. It lacks eg. the import declarations. Please provide a link to the really full code at a specific commit for others to reproduce. -- -j -- You received

Re: [go-nuts] [ANN] 99c

2017-10-07 Thread Jan Mercl
.od...@gmail.com> wrote: > Is there any desire to support c11? > On Sat, Oct 7, 2017 at 1:01 PM Jan Mercl <0xj...@gmail.com> wrote: > >> Command 99c is a c99 compiler targeting a virtual machine: >> https://github.com/cznic/99c >> >> >> >> -- &

Re: [go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Jan Mercl
On Sun, Oct 8, 2017 at 8:02 PM Zack Scholl wrote: > Why does it slow down the code if its not inlined? Since the method is on a pointer struct I assume it wouldn't need to copy anything? Call/return is not free even before stack limit checking, pushing the arguments and

Re: [go-nuts] Re: important

2017-10-09 Thread Jan Mercl
On Mon, Oct 9, 2017 at 6:43 PM Ian Lance Taylor wrote: > Didn't I answer this question already? Obviously you did, I can see your answer in the web interface, but if the OP is using only the mail for communicating with the group, as I do, I must say that your answer never made

Re: [go-nuts] Re: important

2017-10-09 Thread Jan Mercl
On Mon, Oct 9, 2017 at 7:04 PM Francisco Dalla Rosa Soares < dallar...@gmail.com> wrote: > Actually I have the email here from three days ago, so it might have been marked as spam at some inboxes No such message in my spam folder (using inbox.google.com). -- -j -- You received this message

Re: [go-nuts] Is iota increment behavior implemented here?

2017-10-15 Thread Jan Mercl
On Sun, Oct 15, 2017 at 8:59 PM wrote: > I'm writing an article about iota and I've found that its counting behavior is implemented in the below source code? Am I right, if not, where it is? Can you help me? > >

Re: [go-nuts] binary.Read()

2017-10-05 Thread Jan Mercl
On Thu, Oct 5, 2017 at 5:22 PM Johan terryn wrote: > Or is this working as intended? Hard to tell w/o a complete, self contained reproduction program. But note that os.File is not an io.Reader, *os.File is. -- -j -- You received this message because you are

Re: [go-nuts] installing the rename tool

2017-10-05 Thread Jan Mercl
On Thu, Oct 5, 2017 at 5:22 PM sparc1998 wrote: > I tried to install go's rename tool using go get golang.org/x/tools/refactor/rename. This installed some related files in ~/go/src and ~/go/pkg, but it didn't install a new tool in ~/go/bin, and I'm wondering why? Because

Re: [go-nuts] How to generate long int with k random bits.

2017-10-13 Thread Jan Mercl
> On Fri, Oct 13, 2017 at 4:37 PM Christian LeMoussel wrote: See https://golang.org/pkg/math/big/#Int.Rand -- -j -- 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

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 10:58 AM Gianguido Sorà wrote: WAI: "\x32" == "2" -- -j -- 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

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 11:34 AM Ian Davis wrote: > At first glance this looks like a bug in strings.Replacer. What bug do you mean? https://play.golang.org/p/0DBwWt2TU9 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Why go does't have NullInt type on database/sql?

2017-10-12 Thread Jan Mercl
On Thu, Oct 12, 2017 at 2:38 AM 高橋誠二 wrote: > There are NullInt64 and NullFloat64, but not about NullInt, NullFloat. (or NullInt32 etc...) > After scanning from rds, my team always convert them to int, but it seems so silly. That does not work accross architectures. > What

Re: [go-nuts] Testing on Go templates Range's index

2017-09-09 Thread Jan Mercl
On Sat, Sep 9, 2017 at 6:01 PM Tong Sun wrote: As documented , ne is a function, not an infix operator: https://play.golang.org/p/sJSzoNyrJz -- -j -- You received this message because you are subscribed to the

Re: [go-nuts] unicode constant

2017-09-07 Thread Jan Mercl
On Fri, Sep 8, 2017 at 12:09 AM Tong Sun wrote: https://play.golang.org/p/FD8UMrDkf- > How can I make it works? Follow the language specification. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Tiny FSM

2017-09-24 Thread Jan Mercl
On Sun, Sep 24, 2017 at 11:07 AM dc0d wrote: https://youtu.be/HxaD_trXwRE?t=14m7s -- -j -- 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

Re: [go-nuts] Errors out of syscall

2017-10-02 Thread Jan Mercl
On Mon, Oct 2, 2017 at 2:51 PM Chris Hopkins wrote: > Yes, it has dynamic type. That doesn't mean you can't test against it. > I thought the preferred way to to handle errors was for a package to expert the error variables, then you could test for those variables as in the

Re: [go-nuts] Errors out of syscall

2017-10-02 Thread Jan Mercl
On Mon, Oct 2, 2017 at 2:19 PM Chris Hopkins wrote: I'm not sure I understand: error is an interface and it always has some dynamic type when non-nil. But that type cannot by string b/c string does not implement the error interface. -- -j -- You received this message

Re: [go-nuts] Defer with anon func and func literal

2017-09-28 Thread Jan Mercl
On Thu, Sep 28, 2017 at 2:18 PM Karan Chaudhary wrote: That's expected, the specs say that execution of the defer statement evaluates the arguments of the deferred function. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Graphing libraries in golang

2017-09-28 Thread Jan Mercl
On Wed, Sep 27, 2017 at 5:05 PM Vikram Rawat wrote: Also there's https://github.com/cznic/plot. -- -j -- 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,

Re: [go-nuts] Defer with anon func and func literal

2017-09-28 Thread Jan Mercl
On Thu, Sep 28, 2017 at 2:50 PM Karan Chaudhary wrote: > I'm trying to find rationale for this: why is "defer foo(x)" treated differently than "defer func() { foo(x) }" by the language designers? They are not treated differently. The defered functions are different. -- -j

Re: [go-nuts] Example output not visible in godoc

2017-09-25 Thread Jan Mercl
On Mon, Sep 25, 2017 at 10:55 AM snmed wrote: > Has anyone an idea why it is no working correct? Blind shot: Try removing the final empty line:

Re: [go-nuts] Potential race condition in prototypical network server code

2017-08-24 Thread Jan Mercl
No, wg.Add cannot "switch" to wg.Wait, they're both in the samr goroutine, the go statement will be always the next one to execute after wg.Add within serve(). On Thu, Aug 24, 2017, 19:29 Tom Payne wrote: > I'm not singling out Dave Cheney here, I'd just like to check my >

Re: [go-nuts] Potential race condition in prototypical network server code

2017-08-24 Thread Jan Mercl
sday, August 24, 2017 at 7:41:59 PM UTC+2, Jan Mercl wrote: > >> No, wg.Add cannot "switch" to wg.Wait, they're both in the samr >> goroutine, the go statement will be always the next one to execute after >> wg.Add within serve(). >> >> On Thu, Aug 24, 201

<    1   2   3   4   5   6   7   8   9   10   >