[go-nuts] Re: Trying to understand aversion to main package

2024-02-16 Thread Rick
Another motivation I have heard used is that an os.Exit() from main by-passes defer(). So if you need to use defer from a "main-like" context move it to a function called from main(), do your defer(s) in it and then do the os.Exit() from main().. On Friday 16 February 2024 at 01:23:57 UTC-8 Mar

[go-nuts] Re: Idiomatic optional struct fields: zero vs magic value vs bool

2023-12-12 Thread Rick
For my work, the most common place I handle this is POST JSON => Unmarshal to Go struct =-> SQL query. When unmarshaling a JSON body with possibly null fields, like you, I declare the corresponding Go struct fields as pointers. And have wrappers IfNullString(), IfNullInt() etc to convert to a s

Re: [go-nuts] Issue implementing interface method that returns another interface

2023-03-02 Thread Rick Schubert
turn an interface. Or test using the concrete type, instead of using > mocks. > > On Tue, Feb 28, 2023 at 6:08 PM Rick Schubert > wrote: > >> I am having a question about how to implement interfaces correctly in Go >> when it comes to third-party packages that use

[go-nuts] Issue implementing interface method that returns another interface

2023-02-28 Thread Rick Schubert
I am having a question about how to implement interfaces correctly in Go when it comes to third-party packages that use chained methods. I have compiled an example project below for you so that you can understand the problem. package main import ( myAPI "github.com/hashicorp/vault/api" ) var

[go-nuts] Reading data from GeoTIFF with the gdal package

2022-10-26 Thread Rick Walters
Hi, if anyone has any experience with Luke Roth's gdal package… I'm relatively new to Go, and very new to GeoTIFF and GDAL, and struggling a bit. I'm trying to read data from a 32-bit float band of a GeoTIFF (representing elevation) and have two questions: 1. Is there any way to directly a

[go-nuts] Re: Is there a workflow engine written in GO

2022-07-22 Thread Rick
I wouldn't say it's similar to BPEL, but there is Argo Workflows: https://argoproj.github.io/workflows/. Specific to Kubernetes. Each step in the workflow is a runs as a pod. On Thursday, 21 July 2022 at 11:02:37 UTC-7 Crbala Subramanian wrote: > Hi All > > Is there any reference implementation

[go-nuts] Re: Spam email

2022-03-15 Thread Rick
An email is designated as Spam by a heuristic. The heuristic takes into account the name of the server where email is originating, properties of the subject and contents and sender. It's unrelated to the use of Gomail or any other sending library. On Monday, 14 March 2022 at 09:11:13 UTC-7 cick

[go-nuts] Re: Why, oh why, do people do this? Things that annoy me in Go code.

2022-01-31 Thread Rick
Really? The idea that functions should *never* be longer than 2-3 lines is absurd. Functions should take an input, do one thing (without side-effect) and return a result. And their name should indicate what function they compute. Whether that is 2-3 lines or 20-30 lines depends on the function.

[go-nuts] Re: in-memory caching in golang

2021-12-10 Thread Rick
Don't forget to think about cache coherency. Caching is more involved with multiple caching microservices talking to the database. Creates and updates require notification of all replicas to refresh their caches. On Thursday, 9 December 2021 at 23:08:16 UTC-8 Jason E. Aten wrote: > You might pr

Re: [go-nuts] times of stw in one gc cycle?

2021-06-12 Thread Rick Hudson
It won't go on forever. The formal proofs are in the original Sapphire and distributed Train algorithm papers. Informally the proofs show that there is no way to create a new white object, no way to pass white object between threads more than a bounded number of times, reachable non-black objec

[go-nuts] Re: $GOPATH/go.mod exists but should not

2021-01-10 Thread Rick
I'm not entirely following what you are doing. But here are some comments. You have a directory $HOME/go, the contents of which look like what you would see under $GOPATH. If you are going to create a project under $HOME/go (whether GOPATH is defined or not), the suggested place to put it is in

[go-nuts] Re: Go generic set with interesting real world applications

2021-01-04 Thread Rick
This is a great practical generics example. Thanks for sharing! On Sunday, 3 January 2021 at 16:35:38 UTC-8 aphill...@gmail.com wrote: > I am an avid user of Go who loves how it makes my life so much easier due > to its amazing simplicity. I am thrilled to find that a great deal of > progress h

[go-nuts] Re: Generics, please go away!

2020-12-29 Thread 'Rick Timmis' via golang-nuts
My point of view is that Generics should not become part of the Go standard library. I appreciate there are use cases where it is very helpful to have, but I do not believe that adds value to Go. The real value for Go is it's simplicity, avoidance of generics and avoidance of classes. This makes

[go-nuts] Re: directory name and module name not same, go tool pprof, list function faild

2020-08-03 Thread Lee Rick
se the combination of "-source_path" and "-trim_path" still not work my project dir tree macbookpro:tejia_analysis fredlee$ pwd /Users/fredlee/Documents/xxx/tool/tejia_analysis macbookpro:tejia_analysis fredlee$ tree util util ├── analysis.go ├── configure.go ├── cron.go ├── job_discount

[go-nuts] Re: political fundraising on golang.org!

2020-06-15 Thread Rick
I agree with previous posts pointing out that "black lives matter" is not a political message. In fact, it isn't even a social message. It's a statement of fact. Please leave the banner up. On Sunday, 14 June 2020 06:36:38 UTC-7, peterGo wrote: > > Recently, a political message with a fundraisin

Re: [go-nuts] Question about the zero-value design: Why pointers zero value is not the zero value of what they points to?

2020-02-17 Thread Rick Hudson
> type Treenode struct { > left *Treenode > right *Treenode > } One could of course design a language where Treenode is called cons and left is called car and right is called cdr and (car nil) is nil and (cdr nil) is nil. You could implement such a language by putting 2 words of 0 at location

Re: [go-nuts] CGO - Passing pointer to C

2019-12-04 Thread Rick Hudson
Breaking the Go CGO pointer rules comes up periodically and the rules have not changed. Applications have lived with the rules simply because breaking them results in revisiting the application code every time a new Go release comes out. Did the compiler improve and some object is now allocated

[go-nuts] Re: Roadblock for user-implemented JIT compiler

2019-10-23 Thread Rick Hudson
One approach is to maintain a shadow stack holding the pointers in a place the GC already knows about, like an array allocated in the heap. This can be done in Go, the language. Dereferences would use a level of indirection. Perhaps one would pass an index into the array instead of the pointer

[go-nuts] Re: CreateFile hello.go: The system cannot find the file specified

2019-09-21 Thread Rick
Please share hello.go Seems likely it's a Windows vs. *nix file file path issue. On Saturday, 21 September 2019 17:08:54 UTC-7, Kapil Dev wrote: > > Hello Folks > > I am novice in Golang. I just installed Golang on my window based machine > and following are env details > > > > [image: env_Cap

[go-nuts] Re: VS + GO plugin questions

2019-09-17 Thread Rick
I am running VSCode with no GOPATH set, the Copls language server selected and using Go (v 1.13) modules for my projects - works fine. On Monday, 16 September 2019 11:31:14 UTC-7, joe mcguckin wrote: > > I installed this on my Mac. For M$, it actually looks pretty nice. > > I had to remap the F1

[go-nuts] Re: THANKS GO TEAM FOR GOLANG'S NEW VERSION.

2019-09-06 Thread Rick
I second that emotion, brother. Go makes my daily work just a little bit less irritating. On Thursday, 5 September 2019 21:55:48 UTC-7, jfrank...@gmail.com wrote: > > THIS IS NOT ABOUT MISTAKES IS ABOUT THANKS TO ALL PEOPLE THAT MAKE GOLANG > A FANTASTIC CHOISE IN THE LANDSCAPE OF PROGRAMMING LA

[go-nuts] Re: how to merge different struct to one struct

2019-08-24 Thread Lee Rick
i read your code, and try to write my code, package main import ( "fmt" "reflect" ) type A struct{ Name string } type B struct{ Age int } type C struct{ Address string } func Merge(a interface{}, b interface{})( d interface{}) { aType := reflect.TypeOf(a) if aType.Kind() != reflect.Struct { pan

Re: [go-nuts] how to merge different struct to one struct

2019-08-24 Thread Lee Rick
1:25:24,burak serdar写道: > > On Fri, Aug 23, 2019 at 11:11 PM Lee Rick > wrote: > > > > it's not my need, hope other methods > > What is your need? What are the types of the variables d1, d2, d3 in > your example? > > > > > 在 2019年8月24日星期六 UTC+8上午

Re: [go-nuts] how to merge different struct to one struct

2019-08-24 Thread Lee Rick
29:03,Jan Mercl写道: > > On Sat, Aug 24, 2019 at 5:25 AM Lee Rick > > wrote: > > > > i want to do > > type A struct{ Name string} > > type B struct{Age int} > > type C struct{Address string} > > > > a, b, c := A{}, B{},C{} > > have

Re: [go-nuts] how to merge different struct to one struct

2019-08-24 Thread Lee Rick
1:25:01,Kurtis Rader写道: > > On Fri, Aug 23, 2019 at 10:11 PM Lee Rick > wrote: > >> it's not my need, hope other methods >> > > Then you need to explain why that answer is not satisfactory and otherwise > better explain your requirements. In your hypothe

Re: [go-nuts] how to merge different struct to one struct

2019-08-23 Thread Lee Rick
it's not my need, hope other methods 在 2019年8月24日星期六 UTC+8上午11:43:32,burak serdar写道: > > On Fri, Aug 23, 2019 at 9:25 PM Lee Rick > > wrote: > > > > i want to do > > type A struct{ Name string} > > type B struct{Age int} > > type C struct{

[go-nuts] how to merge different struct to one struct

2019-08-23 Thread Lee Rick
i want to do type A struct{ Name string} type B struct{Age int} type C struct{Address string} a, b, c := A{}, B{},C{} have a function d1 := merge(a,b) //d1 like struct{Name string, Age int} d2 := merge(a,c) //d2 like struct{Name string, Address string} d3 := merge(b,c) //d3 like struct{Age int,

[go-nuts] Re: How can I debug high garbage collection rate cause high CPU usage issue in golang

2019-06-05 Thread Rick Hudson
When you say "set up GC rate(10%) to reduce memory usage down to normal" what exactly did the program do? Compute (CPU) costs money and heap memory (DRAM) costs money. Minimizing the sum should be the goal. This requires one to have a model of the relative costs of CPU vs. RAM, HW folks balan

[go-nuts] Println output missing in Windows, but not Linux

2019-03-12 Thread rick
I ran this same program: https://www.thepolyglotdeveloper.com/2017/05/network-sockets-with-the-go-programming-language/ : in Linux, and the output was exactly as expected. But on Windows, I was seeing unexpected results. Sometimes just a newline printed. Sometimes the entire buffer printed, but

[go-nuts] Re: http client POST/GET.. will not save cookie before do redirect request

2018-09-13 Thread Rick
I think what people are trying to explain is that the behavior you may be expecting based on experience with browsers is not built in to the Go (or many other) HTTP clients. Even the Java cookie jar which has been mentioned in this thread was not available in early implementations of Java HTTP

[go-nuts] Re: Operator Overloading Implies Generics?

2018-09-08 Thread Rick
Thanks folks... s/operator/method/ On Saturday, 8 September 2018 18:58:24 UTC-7, Rick wrote: > > With recent discussion concerning the possible introduction of generics in > Go 2, it occurs to me to ask about support for operator overloading in Go > 2. By this I mean support f

[go-nuts] Operator Overloading Implies Generics?

2018-09-08 Thread Rick
With recent discussion concerning the possible introduction of generics in Go 2, it occurs to me to ask about support for operator overloading in Go 2. By this I mean support for functions having the same name but different signature: func foo(x int) int ... func foo(x string) bool ... func f

[go-nuts] http client GET with err : dial tcp:look up xxxxx: Temporary failure in name resolution

2018-08-28 Thread 'Rick Timmis' via golang-nuts
Hi, try running your code in a debugger, it smells like a DNS resolution failing, leaving your code awaiting a response. In a debugger you would be able to see this happening HTH -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr

Re: [go-nuts] Re: golang for AI

2017-12-24 Thread Lee Rick
working in the symbolic AI field though (ontologies, > > constraint solving and that stuff), not machine learning. > > > > Le vendredi 22 décembre 2017 07:33:04 UTC+1, Lee Rick a écrit : > >> > >> hi, > >>Artificial intelligence is a big trend, and i

[go-nuts] Re: golang for AI

2017-12-24 Thread Lee Rick
lang a lot, so I would tend to > say yes. We're working in the symbolic AI field though (ontologies, > constraint solving and that stuff), not machine learning. > > Le vendredi 22 décembre 2017 07:33:04 UTC+1, Lee Rick a écrit : >> >> hi, >>Artificial intelli

[go-nuts] golang for AI

2017-12-21 Thread Lee Rick
hi, Artificial intelligence is a big trend, and i want to know whether or not to consider golang playing a role in artificial intelligence? Whether to consider developing some basic artificial intelligence package with support package, use just as python. -- You received this message bec

[go-nuts] forwarding http request and response

2017-12-20 Thread Lee Rick
hi, when http server receive a request A, create a new http request B with A, do B, get response respB, create a new http respA with respB how to do "create a new http request B with A" and " create a new http respA with respB" with io.copy method, and reset url,params, hosts etc.

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-05 Thread Rick Hudson
can chime in on if it is > possible. > > I will provide the logs from tonight though. Do you want them zipped here > in the thread? > > > tis 5 dec. 2017 kl 15:37 skrev Rick Hudson : > >> Glad to have helped. The runtime team would be interested in seeing what >>

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-05 Thread Rick Hudson
Glad to have helped. The runtime team would be interested in seeing what these pauses look like in the beta. If you have the time could you send them to us after the beta comes out. On Tue, Dec 5, 2017 at 9:06 AM, Henrik Johansson wrote: > Ok so it's not bad, thats good! > > The inital ~20 sec

[go-nuts] Re: Add factory argument to built-in make() function?

2017-08-28 Thread Rick
Interesting idea! Throw in operator overloading to retain the current make and its signature and the new make with addition of factory arg? On Sunday, 27 August 2017 11:38:47 UTC-7, RogerV wrote: > > Would it be feasible for the built-in make() function to be enhanced to > also accept a factory

[go-nuts] Re: default --help flag behavior

2017-07-19 Thread Rick
It's reasonable to consider calling a command with a flag that is not defined an error (whether that flag is -help or -verbose or -whatever). It is common to return non 0 on error. On Wednesday, 19 July 2017 11:31:42 UTC-7, Philippe Modard wrote: > > Hey go-nuts, > > I realize than running `mybi

Re: [go-nuts] golang call c++ api by swig

2017-06-22 Thread Lee Rick
uble >(int,int) instead. gocv_core.i:280: Warning 516: Overloaded method cv::Mat::at< double >(int,int,int) const ignored, gocv_core.i:280: Warning 516: using cv::Mat::at< double >(int,int,int) instead. cp /Users/fredlee/Documents/开发/go/workspace/src/github.com/lazywei/go-

[go-nuts] golang call c++ api by swig

2017-06-22 Thread Lee Rick
hi,guys I wanna wrap opencv2.4.x library to my project by swig, how to do it? anyone can give me a demo ? hope to reply. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving email

[go-nuts] Re: Which Go client for ElasticSearch?

2017-06-02 Thread Lee Rick
i choose https://github.com/olivere/elastic, it works fine. 在 2015年11月5日星期四 UTC+8上午8:21:29,Peter Kleiweg写道: > > The website of ElasticSearch lists three Go clients: > > https://github.com/mattbaird/elastigo > > https://github.com/belogik/goes > > https://github.com/olivere/elastic > > Does anyone

Re: [go-nuts] Latency spike during GC

2017-05-31 Thread Rick Hudson
gc 347 @6564.164s 0%: 0.89+518+1.0 ms clock, 28+3839/4091/3959+33 ms cpu, 23813->23979->12265 MB, 24423 MB goal, 32 P What I'm seeing here is that you have 32 HW threads and you spend .89+518+1 or 520 ms wall clock in the GC. You also spend 28+3839+4091+3959+33 or 11950 ms CPU time out of total o

[go-nuts] Re: ANN: rosarygen 1.0

2017-01-03 Thread Rick
You are a good son indeed! On Tuesday, 3 January 2017 16:36:25 UTC-8, howar...@gmail.com wrote: > > This will probably have a very narrow audience (intersection of > golang-nuts readers and Catholics), but may serve as an example of > functional audio-processing in Go. > > For those unaware, in

Re: [go-nuts] package containing standard CA roots?

2016-12-17 Thread Rick
Alpine is a lightweight option with official Docker images. You can install the CERTS using the Alpine package manager: # apk --no-cache add ca-certificates && update-ca-certificates On Saturday, 17 December 2016 07:32:32 UTC-8, Alex Flint wrote: > > I'm working with busybox, which does not ship

Re: [go-nuts] runtime.GC - documentation

2016-11-29 Thread Rick Hudson
> <https://golang.org/src/runtime/proc.go> and malloc.go > <https://golang.org/src/runtime/malloc.go> with non-blocking mode. As I > read the code, GC eschews the fancy concurrent behavior of the new garbage > collector. > > On Tue, Nov 29, 2016 at 11:46 AM, Rick Hudson >

Re: [go-nuts] runtime.GC - documentation

2016-11-29 Thread Rick Hudson
The documentation is correct. The current runtime.GC() implementation invokes a Stop The World (STW) GC that completes before runtime.GC() returns. It is useful when doing benchmarking to avoid some of the non-determinism caused by the GC. On Tue, Nov 29, 2016 at 1:15 PM, Ian Lance Taylor wrot

[go-nuts] Re: need library suggestions on writing a record program

2016-11-28 Thread Rick
I've written a small program for work in gocui and am quite happy with the results. On Monday, 28 November 2016 08:12:35 UTC-8, bia...@gmail.com wrote: > > i'd like to rewrite an old dos medical patient record program in go for a > friend. its not a complex program by any means > > i'd probably

[go-nuts] Re: go vendoring build issue

2016-10-28 Thread Rick
I recall trying to use the Kubernetes client code some months ago. These sorts of errors ring a bell. You might try building the Kubernetes project as a standalone. It's a huge kitchen sink of a thing and not terribly friendly for someone who wants to do something relatively basic. On Friday, 2

[go-nuts] Re: Unary +

2016-08-19 Thread Rick
This is why I love this group. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://group

[go-nuts] Re: Golang git library able to communicate with LFS?

2016-08-02 Thread Rick Olson
Hi Johann, As Jakob pointed out https://github.com/github/git-lfs/lfs is the closest to a Go library that I know of. Unfortunately, the API is not great and needs to change. I wouldn't depend on it without vendoring to a specific commit. Our focus has been working on a stable command line tool,

[go-nuts] Re: Calling go functions from command line

2016-07-21 Thread Rick
See os.Exec. Also there is a nice project https://github.com/codeskyblue/go-sh that friendly's the stdlib up. On Thursday, 21 July 2016 12:14:04 UTC-7, christ...@google.com wrote: > > Cgo enables us to call C functions from Go programs, and we can run C > functions from command line. > > Are we