[go-nuts] Re: all.bash fails on Ubuntu 24.04?

2024-04-27 Thread Uli Kunitz
:00 PM UTC-7 Uli Kunitz wrote: > >> Hi, >> >> I have installed Ubuntu 24.04 yesterday and there are two failures >> running all.bash compiling go from source. I want to check whether others >> experienced the same before creating one or two golang issues. >>

[go-nuts] all.bash fails on Ubuntu 24.04?

2024-04-26 Thread Uli Kunitz
Hi, I have installed Ubuntu 24.04 yesterday and there are two failures running all.bash compiling go from source. I want to check whether others experienced the same before creating one or two golang issues. git describe --tags returns go1.22.2. Here are the relevant pieces of the ouput of

[go-nuts] Re: slog formatter funcs? (e.g. slog.Infof)

2023-12-14 Thread Uli Kunitz
The documentation of the package says this: "Package slog provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs." If you are using string formatting you are not producing key-value pairs. Following the

Re: [go-nuts] Re: Measuring the total time of serving a request

2023-11-20 Thread Uli Kunitz
You could convert the original ResponseWriter to a ResponseController and call Flush in your middleware before you measure the duration. Alternatively you can try to convert ResponseWriter to a http.Flusher and call Flush if the conversion is successful. The documentation says "Flush flushes

Re: [go-nuts] Why is there no pure StableSort in golang.org/x/exp/slices?

2023-04-23 Thread Uli Kunitz
ose of promising to sort > NaNs stably. > > On Sun, Apr 23, 2023 at 8:05 AM Uli Kunitz wrote: > >> I have a use case where I have to sort int32 slices repeatedly that are >> already partially sorted. (Imagine a tree of smaller non-overlapping >> segments of the sa

[go-nuts] Why is there no pure StableSort in golang.org/x/exp/slices?

2023-04-23 Thread Uli Kunitz
I have a use case where I have to sort int32 slices repeatedly that are already partially sorted. (Imagine a tree of smaller non-overlapping segments of the same slice, where sorting starts at the bottom and moves to the top and the results of the individual sorts are required for the

[go-nuts] Re: Disable AVX, AVX2, AVX-512, SSE support while building a go binary

2023-04-07 Thread Uli Kunitz
After reading the documentation I have to correct. GO386 supports the softfloat option to support older processors which don't support SSE2. Information can be found here: https://github.com/golang/go/wiki/MinimumRequirements#386 On Friday, April 7, 2023 at 8:22:14 AM UTC+2 Uli Kunitz wrote

[go-nuts] Re: Disable AVX, AVX2, AVX-512, SSE support while building a go binary

2023-04-07 Thread Uli Kunitz
Note that SSE2 is not optional and is used for floating point operations on 386 and AMD64. Before 1.16 there has been a GO386 option that supported 387 instructions but it has been removed. GOAMD64 has no influence on it. On Thursday, April 6, 2023 at 7:18:03 AM UTC+2 aditi sinha wrote: > Hi >

Re: [go-nuts] Is this algorithm viable? its faster than AES256 upto 50KB

2022-08-03 Thread Uli Kunitz
The algorithm would only be viable if you you would use a different secret for every password. If the secret is reused, it can be broken with a single known-plaintext attack. The recommendation is always don't do your own crypto. Use PBKDF2, SHA256-CRYPT or Argon2 for password verification. On

Re: [go-nuts] Re: GO program's memory footprint is confusing

2022-05-09 Thread Uli Kunitz
I didn't found the attachment here. Can you put it somewhere. Maybe as github gist? On Monday, May 9, 2022 at 4:18:52 AM UTC+2 garenchan wrote: > /proc//limits of the two processes are the same. > But /proc//smaps of the two processes are quite different, I have > uploaded them to the

Re: [go-nuts] Re: GO program's memory footprint is confusing

2022-05-08 Thread Uli Kunitz
I cannot say what the difference is, but I would do two things to solve the mystery: 1) Compare /proc//limits for differences. 2) Compare the output of egrep '^Rss:|^[0-9a-f]' /proc//smaps for the processes on the different machines. Report the results and share the outputs. On Friday, May 6,

Re: [go-nuts] Issues when using time.Ticker microsecond duration

2022-02-01 Thread Uli Kunitz
In my tests 2000 events per second appear to be fine, but there is an issue a magnitude larger with 20 000 events per second. On Tuesday, February 1, 2022 at 10:50:29 AM UTC+1 Ian Davis wrote: > On Mon, 31 Jan 2022, at 8:33 PM, Uli Kunitz wrote: > > Please have a look at golang.org/x/

Re: [go-nuts] Issues when using time.Ticker microsecond duration

2022-01-31 Thread Uli Kunitz
Please have a look at golang.org/x/time/rate . This package should solve your problem. Here is an example with 10 events per second. func main() { log.SetFlags(log.Lmicroseconds) l := rate.NewLimiter(10, 1) ctx :=

[go-nuts] Re: Add to existing Go Package

2022-01-17 Thread Uli Kunitz
Use log.SetOutput and the io.MultiWriter function to replace the output writer of the log package to write to stdout and a file at the same time. log.SetOutput(io.MultiWriter(os.Stdout, f)) There is a limited capability to influence the timestamp with the SetFlags function. You could also

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-28 Thread Uli Kunitz
I believe time.Local = time.UTC is the right approach. It is true that the loc field of the time structure will be set to and not zero, but I couldn't find a path where this should generate a problem. From my point of view I would regard any issue resulting from it as a bug. Uli On Thursday,

[go-nuts] Re: Inconsistency between calls to "os.Chtimes()" and "stat.Sys().(syscall.Stat_t).Mtimespec"

2021-10-14 Thread Uli Kunitz
Hi, I suggest that you check on MacOs the File System Events API and on Linux inotify or fanotify. Here are links: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html

[go-nuts] Re: Reflect on Rust for Android and Linux kernel support

2021-05-09 Thread Uli Kunitz
There are multiple differences that make Rust a better replacement for C/C++ code than Go: * Go requires a garbage collector and its own scheduler (A Go without GC and goroutines is not Go.) * Go has its own ABI and CGO calls are slow * Rust makes guarantees about memory safety that Go doesn't

[go-nuts] Re: How to manage replace directives in go.mod files when code versioning ?

2021-04-26 Thread Uli Kunitz
Are you aware of "replace directives only apply in the main module's go.mod file and are ignored in other modules. See Minimal version selection for details."? You can find it here: https://golang.org/ref/mod#go-mod-file-replace On

[go-nuts] Re: [ANN] New german translations

2021-03-10 Thread Uli Kunitz
The authority on German Orthography, duden.de, recommends the writing Code but allows Kode as well. On Wednesday, March 10, 2021 at 7:34:05 PM UTC+1 Haddock wrote: > I don't know about using the word "Kode" in German. I've never seen it > different than with c as in English. Whatever, you took

Re: [go-nuts] Endlessly increasing CPU usage problem

2021-03-09 Thread Uli Kunitz
Ian, I recommend to use a newer version. go 1.0.3 has been released in September 2012. On Thursday, January 31, 2013 at 2:57:33 AM UTC+1 ian.ra...@gmail.com wrote: > Thanks Dave, those look like great suggestions. I'm running Go 1.0.3 on > Ubuntu: > > # go version

[go-nuts] Re: Unable to find small memory leak

2021-02-11 Thread Uli Kunitz
en when i manualy trigger the GC! > Also the reachable object is not exported from runtime.ReadMemStats(), > and i'm not sure that the stats from the heapview software are correct. > Thankyou for your help > > > On Wednesday, February 10, 2021 at 12:39:13 AM UTC+1 Uli Kunitz wrote

[go-nuts] Re: Unable to find small memory leak

2021-02-09 Thread Uli Kunitz
Hex wrote: > Thank you, tomorrow i will try it! > Do you know if it possible to enable it without changing the enviroment > variable? My application is started by another one and i can't (easily) > change the enviroment variables. > On Tuesday, February 9, 2021 at 8:57:36 PM U

[go-nuts] Re: Unable to find small memory leak

2021-02-09 Thread Uli Kunitz
It is GODEBUG=allocfreetrace=1 . Documentation for GODEBUG can be found here: https://pkg.go.dev/runtime On Tuesday, February 9, 2021 at 8:39:27 PM UTC+1 Uli Kunitz wrote: > GODEBUG=allocfreetrace may be what you are looking for. You might want to > check the output with sort | u

[go-nuts] Re: Unable to find small memory leak

2021-02-09 Thread Uli Kunitz
GODEBUG=allocfreetrace may be what you are looking for. You might want to check the output with sort | uniq -c. On Tuesday, February 9, 2021 at 8:05:23 PM UTC+1 Miles Hex wrote: > > Hi, > > I'm using golang (1.15.6) to write a daemon that handle system > task(network, time, updates, etc..) in

[go-nuts] Re: Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-04 Thread Uli Kunitz
Hi, You can always do a = append(a[:3], a[4:]...). If you want to remove 2 elements a = append(a[3:], a[:5]). You would need to call remove two times, which is slower and cumbersome. I have rather have two functions like copy and append than a dozen that I have to learn. One of the Go

Re: [go-nuts] Code coverage in error cases when compared to other languages

2021-02-04 Thread Uli Kunitz
The case of somelib.Bar() can be solved by replacing it with an interface. You can than inject a Bar function that always returns an error. Otherwise I would recommend to use fuzzers to increase code coverage. They will do a much better job than you do. For byte sequence interfaces that don't

[go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-30 Thread Uli Kunitz
You need to think about how important it is for the user of your function or method to know about the Close error. Usually when a function closes a resource it also acquires it, so your caller cannot do anything to fix the closure. So I report only the first error. The question that is more

Re: [go-nuts] Generics - please provide real life problems

2020-12-24 Thread Uli Kunitz
I second this. Linear Algebra code would dramatically benefit from generics. Code would become much more simpler if you could write Tensor and Matrix code independent of the type of the numeric values used by those types. Practical applications are graphics libraries, geography applications

Re: [go-nuts] how to get unsigned url (not signed url)

2020-12-22 Thread Uli Kunitz
This assumes that you have made site publicly available as described in the document I have linked. On Tuesday, December 22, 2020 at 12:59:31 AM UTC+1 Alexander Mills wrote: > that is not a google url: > > https://example.com/ > > ? > > On Monday, December 21, 2020 at

Re: [go-nuts] how to get unsigned url (not signed url)

2020-12-21 Thread Uli Kunitz
It is the Google Cloud Storage package. Documentation is here: https://pkg.go.dev/cloud.google.com/go/storage Signed URLs are URLs that allow access to an object in the cloud storage without any other authentication mechanism: https://cloud.google.com/storage/docs/access-control/signed-urls

[go-nuts] Re: assigning to an http request in a handler

2020-12-21 Thread Uli Kunitz
It should be r = r.WithContext(context.WithValue(r.Context(), key, )) Using the address of a key was a typo. On Tuesday, December 22, 2020 at 12:17:01 AM UTC+1 Uli Kunitz wrote: > I don't think this is a good idea. > > I would do something like this. > > type mykey struct{}

[go-nuts] Re: assigning to an http request in a handler

2020-12-21 Thread Uli Kunitz
I don't think this is a good idea. I would do something like this. type mykey struct{} var key mykey r.Use(func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var s string

Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-06 Thread Uli Kunitz
Reading is possible with IP_RECVTOS on Linux but requires the use of recvmsg, because the TOS field is provided as ancillary data. This wouldn't be very portable though. Raw sockets with IP_HDRINCL are a better option if portability is a concern. On Wednesday, August 5, 2020 at 11:33:41 PM

[go-nuts] Re: surprisingly high (persistent) RSS usage after a spike in memory; questions about allocator debugging

2020-06-12 Thread Uli Kunitz
This looks like that your program is allocating a lot of memory once. Note that even if Go has informed the OS with MADV_FREE that memory can be reclaimed, the OS will only reclaim, when there is actual memory pressure. I suggest to read the document of GODEBUG in

[go-nuts] Re: Too many open files / broken pipe issue.

2020-05-09 Thread Uli Kunitz
Please read the section about timeouts in https://blog.cloudflare.com/exposing-go-on-the-internet/ very carefully. This should explain your file descriptor issues. The broken pipe and connection resets are probably clients that closed connections because of timeouts on their side, which may a

Re: [go-nuts] handling constant of maps

2020-05-05 Thread Uli Kunitz
Hi Amarjeet If you take the trouble of using error codes you should use actual integers and not strings. The playground program shows how I would do´ it. See here https://play.golang.org/p/YNbMpXLOUfM > -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Possible bug in turning versions into pseudo-versions

2020-04-29 Thread Uli Kunitz
The documentation provided by go help modules doesn't refer to semver.org and the Backus-Naur-Form there, so you cannot assume it is supported. The semver.org BNF doesn't support the leading v letter, so Go modules versions are anyway incompatible. -- You received this message because you are

[go-nuts] Re: keyword func

2020-04-27 Thread Uli Kunitz
You are correct the func keyword for function definitions is functionally not needed. But it helps readability very much and also allows a natural syntax for anonymous functions and the definition of function types. Another factor is that it simplifies parser programming. > > -- You received

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread Uli Kunitz
The code of the expired function ensure that only the wall time is used for comparisons. My guess is that they developers of the code wanted to avoid any confusion what times are compared. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-03-01 Thread Uli Kunitz
Ian, It is unclear how to interpret the POSIX specification regarding dup2 returning EINTR. The POSIX specification [1] of dup2 says: "If the close operation fails to close *fildes2*, *dup2*() shall return -1 without changing the open file description to which *fildes2* refers." It appears

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-03-01 Thread Uli Kunitz
Thanks, now I understand the concerns better. For Linux I stay with my remark, if you get an error from dup2 nothing has happened. But this is not true for POSIX, which requires the error of the close to be reported. Linux doesn't do it, if you look carefully at the code that I have sent, the

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-29 Thread Uli Kunitz
On Saturday, February 29, 2020 at 9:32:11 PM UTC+1, Philip Boampong wrote > > Whether it cannot harm is what I'm trying to find out. > If newfd gets closed then a retry loop is racy, see my previous messages. > > [1] >

[go-nuts] Re: Go 1.14 Release Candidate 1 is released

2020-02-07 Thread Uli Kunitz
On my microbenchmarks I'm seeing a huge negative impact (ca. 15%) under the Linux ondemand governor. Under the performance governor its less than 1%. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread Uli Kunitz
There is a problem with your C drive. Go uses it to store temporary files. The error messages says it cannot access a file that Go should have created there. It's either a full drive or a permission issues. You can change the location by changing the GOCACHE variable -- You received this

[go-nuts] Re: The smaller argument a time.Sleep call takes, the more allocations?

2019-04-20 Thread Uli Kunitz
The first number in the benchmark output provides the number of iterations the test is run. It has nothing to do with the number of allocations. The default benchmark time is 1 second, explaining the number of iterations you are observing. You can change the time using the -benchtime flag. --

[go-nuts] Re: The aggresiveness of Go module

2019-03-30 Thread Uli Kunitz
This is the behavior for GO111MODULE=on. What is strange that the behavior is different from GO111MODULE=auto outside the GOPATH. I suggest to raise GO issue for clarification. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] Re: time.Now.UnixNano() incorrect under windows7?

2019-03-23 Thread Uli Kunitz
Windows system time has only millisecond resolution. Windows has a feature called performance counters to measure durations with higher resolution. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: How to properly release a new project as a V2 module

2019-03-03 Thread Uli Kunitz
There are two ways to create a v2 branch and they are described in the golang wiki . On Saturday, March 2, 2019 at 2:51:33 AM UTC+1, Marcin Romaszewicz wrote: > > Hi All, > > I've open sourced some work that I've done to

[go-nuts] Re: Gitlab CI loses its marbles attempting go get.

2018-09-10 Thread Uli Kunitz
Use GOPATH= go get *-u* golang.org/x/crypto/ssh/terminal The package golang.org/x/sys/unix is probably old and requires updating. I have no problems on my machine to go get -u golang.org/x/crypto/ssh/terminal. So it is definitely not broken. -- You received this message because you are

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Uli Kunitz
On my 9 year old Core i7 950 3 GHz on Ubuntu 16.04 I get 54 ns/op for your test using go1.10.2. On Thursday, May 24, 2018 at 7:48:50 PM UTC+2, Uli Kunitz wrote: > > The following explanation might be relevant: > > > https://blog.packagecloud.io/eng/2017/03/08/system-calls-

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Uli Kunitz
The following explanation might be relevant: https://blog.packagecloud.io/eng/2017/03/08/system-calls-are-much-slower-on-ec2/ The Go runtime, at least for 1.10, supports VDSO on Linux. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: golang maps; using slice as a key

2018-05-23 Thread Uli Kunitz
You don't need maps for this: https://play.golang.org/p/ylIdX7P9Syy Sorting is your friend. -- 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

[go-nuts] Re: bytes.Buffer Grow() doesn't always increase Cap()?

2017-12-20 Thread Uli Kunitz
Grow ensures that there are at least n bytes to write.The call to bb.Grow(2) in the example will not change the underlying byte slice, because there are already two bytes to write. A call to bb.Grow(initial+growth), which is bb.Grow(4) in the example, will enlarge the buffer to 8 bytes and

[go-nuts] Re: Having a Model Package

2017-12-16 Thread Uli Kunitz
> > I've been reading the other day: "having a model package, is considered a > code smell, in Go". > > 1 - Why? > Assuming you are following the Model-View-Controller you will have to export your full data model in model, so that controller and view can have access to it. But then every

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

2017-10-08 Thread Uli Kunitz
A function call per input byte will slow your code down unless the function is inlined. The for loop is quite simple so I wonder why you want to separate it. You should also think about whether you want to replace the process method by a Write method, making your object an io.Writer and much

[go-nuts] Re: database/sql - prepared select statements only work on first invocation

2017-08-28 Thread Uli Kunitz
I can't replicate your issue. I have create following example, which works perfectly for me on Linux, AMD64 and go 1.9: https://gist.github.com/ulikunitz/d5335e0667fb57b2d12c8ffa5404b031 You should create something comparable so that others can test your code. -- You received this message

[go-nuts] Re: database/sql - prepared select statements only work on first invocation

2017-08-28 Thread Uli Kunitz
Where are you calling Exec on the statement? On Monday, August 28, 2017 at 3:52:54 PM UTC+2, Ain wrote: > > Hi > > Tested with 1.9 and got the same behaviour - first row is returned OK, the > second returns error. > > Does anyone use prepared select statements sucessfully? With which >

[go-nuts] Re: can't open file if its name was read from stdin

2017-08-25 Thread Uli Kunitz
Good, that you found the problem yourself. I wasn't aware that you were on Windows were newlines are represented by CRLF ("\r\n"). TrimSpace would deal with that as well. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: can't open file if its name was read from stdin

2017-08-24 Thread Uli Kunitz
ReadString returns the line including the terminating newline ('\n'). You can check it with fmt.Printf("filename: %q\n", filename). One option to fix it is using function strings.TrimSpace. It will remove all space characters at the start and the end of the string. -- You received this

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Uli Kunitz
I assume here that the proposal is not to change io.Reader but to create a new interface, maybe context.Reader. There are lot of uses of io.Reader where the Read operations will not block and therefore no context is necessary. A context.Reader would also require a wrapper function that

Re: [go-nuts] Re: unexpected strconv.FormatFloat behaviour

2017-07-02 Thread Uli Kunitz
You are correct, there is no difference with C printf for these values. -- 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.

Re: [go-nuts] Re: Set LD_LIBRARY_PATH while executing go test

2017-06-18 Thread Uli Kunitz
t; env variable? > > On Friday, 16 June 2017 18:08:24 UTC+5:30, messju mohr wrote: >> >> ... and a shell agnostic way would be: >> >> $ env LD_LIBRARY_PATH=/foo/bar go test >> >> (see the man page of env(1)) >> >> regards >> >

[go-nuts] Re: Set LD_LIBRARY_PATH while executing go test

2017-06-16 Thread Uli Kunitz
Bash supports: ``` LD_LIBRARY_PATH=/foo/bar go test ``` Is that what you want? -- 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

[go-nuts] Re: Clearer float parsing API

2017-04-12 Thread Uli Kunitz
I don't think that is a good idea because to stay consistent multiple versionw of ParseUint, ParseInt, FormatInt and FormatUint would have to be added to the package. Those functions would make the interface of package strconv much larger. Nobody stops you though to define your private

[go-nuts] Re: Number of OS threads used by Go runtime

2017-04-06 Thread Uli Kunitz
I suggest to give n, _ := runtime.ThreadCreateProfile(nil) a try. On Thursday, April 6, 2017 at 5:37:55 PM UTC+2, Юрий Шахматов wrote: > > Hi all! > > Is there any way to count number of OS threads used by Go runtime > programmatically (ie without using bash with top/ps and others)? > > -- >

[go-nuts] Re: Random Number Genaration - Golang -- Error/Bug

2017-04-04 Thread Uli Kunitz
Hi Mukund, Please recognize that the Source object returned by rand.NewSource is not safe for concurrent use by multiple goroutines. Look at the documentation of NewSource in package math/rand. You are defining r as a global variable and probably call pickENI() from multiple goroutines, which

[go-nuts] Re: Really weird timezone behavior.

2017-02-05 Thread Uli Kunitz
The Playground doesn't appear to support correct timezone info. The time package is modified on the Playground. Your program runs as expected on my local machine. You are certainly aware that it is not properly formatted and doesn't do proper error handling. On Saturday, February 4, 2017 at

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Uli Kunitz
The language spec seems to allow a1 and a2 to have the same address but doesn't require that to be always the case. At the one hand: *Taking the address of a composite literal generates a pointer to a unique variable initialized with the literal's value. *[Composite Literals] On the other

[go-nuts] Re: https://http2.golang.org/ shows http/2 disabled on chrome but it's not!

2016-12-29 Thread Uli Kunitz
It must be something in your setup. It works for me here with Chrome 55.0.2883.87 m (64-bit) on Windows 10 Home 1604 Build 14393.576. On Thursday, December 29, 2016 at 11:25:40 PM UTC+1, Mahdi Ziraki wrote: > > so far: > firefox & chrome Ubuntu 16.0.4 works fine. > firefox & chrome Android

[go-nuts] Re: list tests without actually running them

2016-12-28 Thread Uli Kunitz
I'm not aware of any option that does that. For the local directory ``` grep 'func *Test' *_test.go | sed 's/func *//;s/(.*$//' ``` should work. I would however recommend to use the Skip method of the testing.T type to prevent test functions from execution. You may want to control skipping

[go-nuts] Re: [security] Go 1.7.4 and Go 1.6.4 are released

2016-12-01 Thread Uli Kunitz
I find it unfortunate that the fix for #17276 "time: TestLoadFixed failure" has not been included in go1.7.4. So tests in all.bash (to buiild from source) will fail on a fully patched Ubuntu 14.04 LTS. I expect go tool dist test to fail on all Linux

[go-nuts] Re: flag: Stack overflow when return stringer with fmt.Sprint

2016-09-01 Thread Uli Kunitz
fmt.Sprint(sl) is not the same as fmt.Sprint(*sl). That makes the String methods in both examples different. On Thursday, September 1, 2016 at 12:02:04 PM UTC+2, Shulhan wrote: > > On Thursday, 1 September 2016 16:25:24 UTC+7, dja...@gmail.com wrote: >> >> Hi, >> Do you know what infinite

[go-nuts] Re: Go test package names

2016-08-03 Thread Uli Kunitz
Tests are usually included in the package. Testing a package cannot become easier this way and it is the only way to test internal functions, types, variables or constants. However if you have large test files, it may make sense to keep them in a separate repository because go-getting the

[go-nuts] Re: [cgo] go strings and go pointers

2016-07-26 Thread Uli Kunitz
It is ensured that the C string is deallocated (freed) by SQLite? Otherwise you have a memory leak. Returning a GO string cannot work for two reasons: 1. Go strings are under management of the GC and might reallocate the string memory while the C code is running. 2. Go strings have

[go-nuts] Re: overflow, underflow, carry, zero etc in integer ops

2016-07-12 Thread Uli Kunitz
You need compare the result with one summand to detect overflow. See here: https://play.golang.org/p/3Uh0eFSbQW Programming languages usually don't provide access to machine level flags, because they support combining multiple operations in one expression. For example what should the carry

[go-nuts] Re: Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Uli Kunitz
You might want to look at sync.Pool for reusing temporary objects of the same type. Otherwise you want to check whether all the temporary objects are really required. On Saturday, July 9, 2016 at 8:40:15 AM UTC+2, Arthur wrote: > > the program need parser SQL, and generate the AST node