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] 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] 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] 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] 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] 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?

[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] 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

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-17 Thread Jan Mercl
On Mon, Jul 17, 2017 at 7:18 PM Jeff Templon wrote: > Sure: I hoped for a number of which you don't know the factors and wanted to cheat by linking to factordb.com ;-) Earlier you wrote also > it turns out that 77% of the time of the program is spent in

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-17 Thread Jan Mercl
On Mon, Jul 17, 2017 at 4:09 PM Jeff Templon wrote: > Generally I'm factoring numbers that I can do in less than a day, so in the order of 60 to 100 decimal digits. Just for fun: Please provide a sample in that range. -- -j -- You received this message

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-17 Thread Jan Mercl
On Mon, Jul 17, 2017 at 3:57 PM Jeff Templon wrote: > Coming back to this, now that my Go knowledge is increasing: Out of curiosity, how big are the numbers you want to factorize? -- -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] 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] My project is now missing from godoc

2017-07-09 Thread Jan Mercl
On Sun, Jul 9, 2017, 16:45 Tong Sun <suntong...@gmail.com> wrote: > > > On Sun, Jul 9, 2017 at 10:41 AM, Jan Mercl wrote: > > >> >> On Sun, Jul 9, 2017, 16:35 Tong Sun wrote: >> >>> Hi, >>> >>> My project is *now* missing

Re: [go-nuts] My project is now missing from godoc

2017-07-09 Thread Jan Mercl
On Sun, Jul 9, 2017, 16:35 Tong Sun wrote: > Hi, > > My project is *now* missing from godoc, the > http://godoc.org/github.com/go-easygen/easygen > is *now* returning "Not Found". > > It has always been working before, for > https://github.com/go-easygen/easygen > > What's

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] Capture test output per-function

2017-07-06 Thread Jan Mercl
You should never use fmt.Printf in a test. Use t.Logf instead. On Thu, Jul 6, 2017, 17:29 <buchanae.o...@gmail.com> wrote: > On Thursday, July 6, 2017 at 12:40:30 AM UTC-7, Jan Mercl wrote: > >> On Thu, Jul 6, 2017 at 12:56 AM <buchan...@gmail.com> wrote: >> >

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] 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: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 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 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] 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] 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] 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] 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] 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] 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] 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] 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

[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] [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 ?

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] 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] 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] 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] 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] 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] 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] 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] "%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] "%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] 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: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] 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] 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 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 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] 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] 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] 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: 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] 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] 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] 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] [ANN] sqlite

2017-04-21 Thread Jan Mercl
On Fri, Apr 21, 2017 at 7:03 AM Jérôme LAFORGE wrote: > It is driver only or that contains also the process that manages the data via sql? The driver works in-process by calling into an included virtual machine that's loaded by code compiled from sqlite3.c via go

[go-nuts] [ANN] sqlite

2017-04-20 Thread Jan Mercl
Early preview of a DB driver for SQLite without CGO: https://github.com/cznic/sqlite ATM Linux/Intel only. -- -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] Zero value of the map

2017-04-20 Thread Jan Mercl
On Thu, Apr 20, 2017 at 9:42 AM Will Faught wrote: > Why couldn't maps be implemented as a pointer to the map implementation? If you try to use the map and the pointer is nil, then the map allocates the backing implementation. Pseudocode for a built-in implementation: > >

Re: [go-nuts] Naming projects with multiple words

2017-04-19 Thread Jan Mercl
On Wed, Apr 19, 2017 at 3:48 PM Tong Sun wrote: > what's your preference and why? example.com/name/onenamenopunctutaionalllowercasetwotoninecharacters b/c ~ what POSIX recommends for utility names. -- -j -- You received this message because you are subscribed to

Re: [go-nuts] Infinite loops

2017-04-18 Thread Jan Mercl
On Tue, Apr 18, 2017 at 6:57 PM Frank Davidson wrote: > Which loop uses the least computer resources? select{} -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Jan Mercl
On Thu, Apr 13, 2017 at 6:31 PM wrote: > https://play.golang.org/p/swRxxCbb65 > > Surely s1 uses more than 8 bytes. no -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Memory use of a value

2017-04-13 Thread Jan Mercl
On Thu, Apr 13, 2017 at 6:24 PM AWildTyphlosion < sdic...@watchtower-security.com> wrote: > I'm trying to figure out how much memory a value. Anyone have a clue how to? unsafe.Sizeof/reflect.Type.Size -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] better way to document go lib ?

2017-04-09 Thread Jan Mercl
On Sun, Apr 9, 2017 at 1:21 PM wrote: > TLDR: Who wants to read markup language instead of normal, easy for human readable comments? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] what's the max length of an identifier

2017-04-05 Thread Jan Mercl
On Wed, Apr 5, 2017 at 12:23 PM wrote: > But i don't find such specification for Golang.Is there any limit on the length of an identifier in Golang? The lack of a specified limit implies no limit other than resources available to the compiler and/or the program. -- -j --

Re: [go-nuts] Re: Algorithm Club

2017-03-31 Thread Jan Mercl
On Fri, Mar 31, 2017 at 6:20 PM Michael Jones wrote: > I recalled it i the sort case because I wanted to kinds of typed clients for "<", the kind where !Less(a,b)&&!Less(b,a) === Equal(a,b), and the kind where that is not the case--and ideally--a way to have

Re: [go-nuts] go run package

2017-03-30 Thread Jan Mercl
On Thu, Mar 30, 2017 at 11:28 AM Paul Jolly wrote: > go run github.com/fruit/banana arg1 arg2 ... I don't like the idea of giving go run any more powers. It is already being horribly abused. Your users can perhaps try $ $GOPATH/bin/banana arg1 arg2 if properly

Re: [go-nuts] Re: directory name versus package name

2017-03-30 Thread Jan Mercl
On Thu, Mar 30, 2017 at 1:41 AM Dorival Pedroso wrote: > I like the idea that the go tool would enforce matching directory and package names. I don't know why it should be enforced, but consider that commands must be in package main. -- -j -- You received this

Re: [go-nuts] directory name versus package name

2017-03-29 Thread Jan Mercl
On Wed, Mar 29, 2017 at 9:19 AM Dorival Pedroso wrote: > Anyway, so, why using package mylib then? 'mylib' is the implicit qualifier used to access the exported identifiers from that package from within a package importing it. -- -j -- You received this message

Re: [go-nuts] could not determine kind of name for C.uint32_t

2017-03-24 Thread Jan Mercl
On Fri, Mar 24, 2017 at 4:54 PM Ignazio Di Napoli wrote: > How can debug the problem? Assuming the error comes from[0], I would try to add to the list of C includes near the top of that file. [0]:

Re: [go-nuts] Expression evaluation with side effects

2017-03-21 Thread Jan Mercl
On Tue, Mar 21, 2017 at 6:11 PM John McKown wrote: > ​Logically yes, but due the implementation, along with "side effects" (undocumented?), it does. The "x[0]|=foo()" moves x[0] to a temporary area. It then invokes foo(). It then does the logical or from the

Re: [go-nuts] go get and private repositories (GH:E)

2017-03-21 Thread Jan Mercl
On Tue, Mar 21, 2017 at 4:44 PM andrey mirtchovski wrote: > any suggestions? AFAICT, public as well as private Github repository URLs do _not_ have the slash after the colon in the URL, like in g...@github.com:user/foo.git. -- -j -- You received this message because

[go-nuts] Expression evaluation with side effects

2017-03-19 Thread Jan Mercl
While trying to resolve a failing (C) test case[0] I encountered a (Go) behavior I do not understand. This code[1] package main import ( "fmt" ) var ( x = [1]int{2} x2 = [1]int{2} ) func foo() int

Re: [go-nuts] Aren't package declarations (and per file imports) redundant?

2017-03-18 Thread Jan Mercl
On Sat, Mar 18, 2017, 12:49 wrote: > > > The toolchain already seems to understand the directory layout then why > bother littering the sources with package declaration? > The package declaration is not related to the directory layout. -- -j -- You received this message

Re: [go-nuts] dep: Roadmap for merging into the toolchain

2017-03-14 Thread Jan Mercl
On Tue, Mar 14, 2017 at 12:15 PM Sam Boyer wrote: > I'm don't think that's an accurate summary, at all. The proof is easy ;-) -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] dep: Roadmap for merging into the toolchain

2017-03-14 Thread Jan Mercl
On Tue, Mar 14, 2017 at 8:01 AM Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > Please don't miss the monumental heaps of discussions about package management in Go [1]. Executive summary: Solving the Go's package dependency resolution problem can be either automatic or correct.

Re: [go-nuts] RSQL, a lighweight clone of Microsoft SQL Server written in Go

2017-03-13 Thread Jan Mercl
On Mon, Mar 13, 2017 at 10:10 PM 'simon place' via golang-nuts < golang-nuts@googlegroups.com> wrote: > i see Apache 2 licence file in the root.(github) That repository seems to contain only "Go driver for connecting to RSQL database server". I followed OP's link chain - http://rsql.ch/ -

Re: [go-nuts] RSQL, a lighweight clone of Microsoft SQL Server written in Go

2017-03-13 Thread Jan Mercl
On Mon, Mar 13, 2017 at 9:13 PM nicolas riesch wrote: > But it would help me to have your first impression or opinion on this project. Sounds very very interesting, but... Here are the first impressions: - I can see no LICENSE or similar file in the root directory. I

Re: [go-nuts] Re: What happens when appending to a slice exceeds the backing capacity?

2017-03-13 Thread Jan Mercl
On Mon, Mar 13, 2017 at 8:05 AM st ov wrote: > I know it can be accessed the question relates to this > http://stackoverflow.com/questions/36706843/how-to-get-the-underlying-array-of-a-slice-in-go Let me ask what do you need the backing array for which cannot be done using

Re: [go-nuts] Re: What happens when appending to a slice exceeds the backing capacity?

2017-03-12 Thread Jan Mercl
rch 12, 2017 at 12:13:03 PM UTC-7, Jan Mercl wrote: > > On Sunday, March 12, 2017 at 11:49:33 AM UTC-7, st ov wrote: > > > What happens when appending to a slice exceeds the backing capacity? > > If the capacity of s is not large enough to fit the additional values, > append a

Re: [go-nuts] Re: What happens when appending to a slice exceeds the backing capacity?

2017-03-12 Thread Jan Mercl
On Sunday, March 12, 2017 at 11:49:33 AM UTC-7, st ov wrote: > What happens when appending to a slice exceeds the backing capacity? If the capacity of s is not large enough to fit the additional values, append allocates a new, sufficiently large underlying array that fits both the existing slice

[go-nuts] How to install x/tools/cmd/goyacc?

2017-03-09 Thread Jan Mercl
I am not able to help with an issue reported ( https://github.com/cznic/goyacc/issues/23). I suggested to do $ go get -u golang.org/x/tools/cmd/goyacc but that does not seem to work. I tried this: jnml@4670:~$ go get -u -v -x golang.org/x/tools/cmd/goyacc cd

Re: [go-nuts] memory gc when slice shortcut

2017-03-09 Thread Jan Mercl
On Thu, Mar 9, 2017 at 11:45 AM 代君 wrote: > I have a []*Struct, at some times it length grow to 1000, after that, the slice be shortcut to length of 10, and never grow to 1000 again. > dose the memory of *Struct at slice's tail will never be gc? It will not be garbage

Re: [go-nuts] sort.Slice arguments

2017-03-08 Thread Jan Mercl
On Wed, Mar 8, 2017 at 2:10 PM Val wrote: > What do you think? You should explain what you've expected to get instead of what you've got. Without that, I for one, cannot figure out what you see as broken and I have no idea why do you think it's not a good idea to sort a

Re: [go-nuts] Slice from interface doesn't work as expected

2017-03-02 Thread Jan Mercl
On Thu, Mar 2, 2017 at 2:46 PM wrote: > Can somebody explain me why? Did you mean https://play.golang.org/p/GUVZBUQlEj ? -- -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] Goroutine in a for loop: Closure versus direct

2017-02-25 Thread Jan Mercl
> I think both these approaches are fine, but just wanted to check. They're not, #2 has a data race. -- -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] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-16 Thread Jan Mercl
On Thu, Feb 16, 2017 at 8:20 PM Dragos Harabor wrote: > Is there any way to check whether the value stored in a non-nil interface is nil when you don't know the type, short of using reflect.Value.IsNil()? For example: https://play.golang.org/p/Sdqx7Frjxj -- -j -- You

Re: [go-nuts] will GC close unused connection ?

2017-02-15 Thread Jan Mercl
On Thu, Feb 16, 2017 at 8:20 AM wrote: > Will GC close unused connection ? No. At least not directly. A finalizer can possibly do that and finalizers are possibly invoked by the GC. -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Why get an element from []interface{} `arr[0] == nil` is not true?

2017-02-15 Thread Jan Mercl
On Wed, Feb 15, 2017 at 9:40 AM Felix Sun wrote: Why `arr[0] == nil` is not true? Because it's not a nil interface{}: https://play.golang.org/p/w-od_KHWlc See also https://golang.org/doc/faq#nil_error -- -j -- You received this message because you are subscribed to the

Re: [go-nuts] [Proposal] Std Lib Logging Abstraction

2017-02-12 Thread Jan Mercl
On Mon, Feb 13, 2017 at 8:44 AM Sotirios Mantziaris wrote: > ... which prohibit me of using anything else if i want to have a consistent logging experience. What does "consistent logging experience" mean? -- -j -- You received this message because you are subscribed

Re: [go-nuts] Go Optimizations for IO Intensive programs

2017-02-12 Thread Jan Mercl
On Sat, Feb 11, 2017 at 1:58 AM wrote: > Are there any other methodologies where I can optimize compresssion part and upload part Many ISPs have upload speed several times slower than download. The symptoms you described would be consistent with that. But maybe you

Re: [go-nuts] Unexpected Behaviour of goroutine

2017-02-12 Thread Jan Mercl
On Sun, Feb 12, 2017 at 11:51 AM Srivathsan Madhavan wrote: A race detector should complain about write to i here for i := 0; i < 5; i++ { concurrently with reading i here log.Println("i=", i) Passing i to the goroutine, instead of sharing it should

Re: [go-nuts] CodeReviewComments: Recommendation of gofmt

2017-02-11 Thread Jan Mercl
On Sat, Feb 11, 2017 at 5:07 PM Axel Wagner wrote: > What about a) vs. c)? c) is fine, but as it's a matter of personal taste, ie. it's IMO more or less bike shedding. IOW, whatever choice as long as it's a single one. Actually, the split goimports bring to the

Re: [go-nuts] CodeReviewComments: Recommendation of gofmt

2017-02-11 Thread Jan Mercl
On Sat, Feb 11, 2017 at 4:30 PM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Am I alone in being bothered by this? ^^ My personal opinion is that a tool that can, even potentially, turn a valid program into an invalid one, or worse, silently into another valid program

<    5   6   7   8   9   10   11   12   >