Re: [go-nuts] is running interactive or not

2023-06-08 Thread Chris Burkert
Hi, there are cases when this does not work. I tend to use a flag like -batch or -noninteractive to trigger the correct behavior from within scripts. Less magic, more control. Rich schrieb am Do. 8. Juni 2023 um 20:19: > Hi, > > I have a program I am writing that stops and asks the user for

Re: [go-nuts] Learning Go on internal server

2023-02-16 Thread Chris Burkert
Go can be run on a regular Mac or PC. Maybe you don’t need a tools server for this at all. However, in a corporate environment caching dependencies may be a good thing. With modules this is done by running your own Go proxy. Take a look at https://github.com/gomods/athens or

Re: [go-nuts] extract VCS branch name used during build

2023-02-06 Thread Chris Burkert
You can use go:generate and go:embed to achieve this. In our CI/CD pipeline we generate a json file with a lot of information like vcs, branch, tag, date and time, hash and a lot more. Then we embed this json into the binary. I became aware of this technique from

Re: [go-nuts] Silly question about parentheses

2023-02-01 Thread Chris Burkert
Looking into the spec: https://go.dev/ref/spec#Return_statements ReturnStmt = "return" [ ExpressionList ] . ExpressionList = Expression { "," Expression } . ... no () here https://go.dev/ref/spec#Function_types FunctionType = "func" Signature . Signature = Parameters [ Result ] . Result

Re: [go-nuts] Underscore symbol

2022-11-05 Thread Chris Burkert
I am curious: from a compiler perspective, does that mean that by using _ simply less assembler instructions are created by not handling those registers which relate to _? Marcel Huijkman schrieb am Sa. 5. Nov. 2022 um 09:18: > When I explain it during my training I always say it is a trashcan

Re: [go-nuts] Re: about upstream?

2022-11-04 Thread Chris Burkert
I am also not a native speaker, but having a stream/river in mind, then upstream seems to be where the water comes from and downstream where the water is going to. However, the OP mentioned that one micro service called the other which tells me something about how the connection is established,

Re: [go-nuts] How do I set a pkg's version?

2022-11-02 Thread Chris Burkert
We used the traditional way for a long time. But with the embed package we stopped this. This is a good blog post on the topic: https://levelup.gitconnected.com/a-better-way-than-ldflags-to-add-a-build-version-to-your-go-binaries-2258ce419d2d . Am Mi., 2. Nov. 2022 um 09:54 Uhr schrieb Jakob Borg

Re: [go-nuts] How do I set a pkg's version?

2022-11-01 Thread Chris Burkert
During CI/CD we create a json file with a few details (git tag, branch, hash, date, time). Afterwards we compile Go Code which embeds this file into the binary. During runtime flags like --version print the json. Note that this is about the version of some binary - not the version of a package.

Re: [go-nuts] How to distribute database connection across all golang file ?

2022-01-11 Thread Chris Burkert
Hi, The standard sql package (https://pkg.go.dev/database/sql) comes with a connection pool. I think it is the DB struct handling the pool. The drivers which implement the details for a specific database product usually come with plenty of documentation and examples. See

Re: [go-nuts] Where to copy vendor to the go docker builder?

2021-09-02 Thread Chris Burkert
Would it help to set up your own module proxy e.g. with https://github.com/gomods/athens or https://github.com/goproxy/goproxy? K Prayogo schrieb am Do. 2. Sept. 2021 um 03:54: > I'm trying to make docker build faster for software that are built with > golang > tried to cache layer but it still

Re: [go-nuts] Re: vendoring related question/issue

2021-06-18 Thread Chris Burkert
I believe you should distinguish between the build and the run environment. Your build environment is largely defined by the language and its ecosystem, e.g. the vendor folder has a semantic for the Go tools. After the build you deploy the resulting artifacts to your run environment. That may be

Re: [go-nuts] Releasing a V2 module and interacting with git branches

2021-04-08 Thread Chris Burkert
I have good experiences with trunk based development meaning that “master” (we use “main”) is the main development line and you down-port to release branches with cherry picking and tags. So as soon as you commit something which is considered a major change (requiring a new version) then also

[go-nuts] Thanks

2021-03-24 Thread Chris Burkert
Several messages during the last weeks irritated me and I guess I was not the only one. Eventually we are all humans but often enough we don’t treat ourselves like that. Let’s treat machines like machines and humans like humans - not the other way round. That’s why I want to say “Thank you

Re: [go-nuts] I am facing goroutine leak issue. I am using cloudfoundary goclient libary to do some operations - Create service/Lastoperation/Update/Delete service instance.

2020-05-30 Thread Chris Burkert
Most of us do not own a crystal ball but with some code reproducing the issue (http://sscce.org/) you may get helping answers. schrieb am Mi. 27. Mai 2020 um 19:07: > goroutine profile: total 12 > 3 @ 0x1032760 0x10420bb 0x1309343 0x105fc71 > # 0x1309342

Re: [go-nuts] Re: flags package: shared flags and flag sets

2020-05-07 Thread Chris Burkert
t; > The '-d' option is a shared flag, and `-rt' is dedicated for the > subcommand 'stream'. > > > On Wednesday, May 6, 2020 at 8:08:25 PM UTC+8, Chris Burkert wrote: >> >> Dear all, >> >> I'd like to mix shared flags with flags specific to flag sets (cooltool >

[go-nuts] flags package: shared flags and flag sets

2020-05-06 Thread Chris Burkert
Dear all, I'd like to mix shared flags with flags specific to flag sets (cooltool ). However I struggle to parse the shared flags only and pass the rest to the flagset for parsing. Here is what I came up with: https://play.golang.org/p/Jazn3aSX9-d Do I have to pick a different flag library or

Re: [go-nuts] Re: marshal multiple json documents which may have different format versions into the latest struct version

2020-04-29 Thread Chris Burkert
That sounds like a good plan. I'm going to try that. Thank you Manlio! Am Di., 28. Apr. 2020 um 15:11 Uhr schrieb Manlio Perillo < manlio.peri...@gmail.com>: > On Tuesday, April 28, 2020 at 10:52:56 AM UTC+2, Chris Burkert wrote: >> >> Dear all, >> >> m

[go-nuts] marshal multiple json documents which may have different format versions into the latest struct version

2020-04-28 Thread Chris Burkert
Dear all, my application users shall be able to provide multiple json documents (files and urls) which I'd like to marshall into one structure. Additionally these json documents may have different versions. I know how to marshal a document into a version specific struct if I know the format

Re: [go-nuts] the size of the files compiled in GO

2020-04-18 Thread Chris Burkert
https://golang.org/doc/faq#Why_is_my_trivial_program_such_a_large_binary schrieb am Sa. 18. Apr. 2020 um 19:25: > Why does the simple Hello world program take 2 MB after compilation? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To

Re: [go-nuts] libgo is more fast that grouting.

2020-03-20 Thread Chris Burkert
Do people ask for a Tesla with a combustion engine? No because they value what Tesla is doing and why they are doing it. And neither Tesla nor Kubernetes or Docker are research projects. So please don’t whine about how things are. Instead (as Ian said) participate in a positive manner and

Re: [go-nuts] Re: McAfee and the module cache on WSL: rename : permission denied

2020-03-13 Thread Chris Burkert
learned something new. many thanks to both of you Am Fr., 13. März 2020 um 19:47 Uhr schrieb brainman : > On Friday, 13 March 2020 08:58:24 UTC+11, Chris Burkert wrote: >> >> Dear all, >> >> besides other environments I have a company laptop running Windows 10 >&g

[go-nuts] McAfee and the module cache on WSL: rename : permission denied

2020-03-12 Thread Chris Burkert
Dear all, besides other environments I have a company laptop running Windows 10 Enterprise with WSL and Ubuntu. In Ubuntu I installed Go 1.14 and wanted to play around with Gio for fun. However it seems that McAfee doesn't want me to. In short this is what I do and (mostly) get: $ cd ~ $ mkdir

Re: [go-nuts] Preserving extra properties using JSON unmarshal / marshal?

2020-02-21 Thread Chris Burkert
Take a Look at https://blog.golang.org/json-and-go: The json package uses map[string]interface{} and []interface{}values to store arbitrary JSON objects and arrays; it will happily unmarshal any valid JSON blob into a plain interface{} value. The default concrete Go types are: - bool for JSON

Re: [go-nuts] Sybase SQLAnywhere driver for Unix systems

2020-01-16 Thread Chris Burkert
Hello, we are working on a pure Go implementation of the TDS protocol for https://github.com/SAP/go-ase (which is currently just a cgo driver). I am not sure if TDS is also understood by SQLAnywhere but if so, then this may help. I will see if I find more in the company and let you know. reda

Re: [go-nuts] Mocked method not working in golang while running the test cases

2020-01-11 Thread Chris Burkert
You could inject your dependencies. There is a funny talk by Liron Levin [1] which helped me a lot. 1: https://youtu.be/_B_vCEiO4mA prakash sharma schrieb am Sa. 11. Jan. 2020 um 16:24: > Need help: > >

Re: [go-nuts] How do I initialize extemplate (a template engine in golang) so that I can use with Echo minimalist framework

2020-01-08 Thread Chris Burkert
xt := {} leaves the templates field nil. Ehioje Henry Erabor schrieb am Mi. 8. Jan. 2020 um 15:59: > I am having issues using extemplate library in my echo framework project. > Library :https://github.com/dannyvankooten/extemplate > > My Code is below: > > Enter code here...package main > >

Re: [go-nuts] Simple worker pool in golnag

2019-12-28 Thread Chris Burkert
ask was to limit the whole thing to about 10% of cores) > > I still don't think you needed a worker pool here. Like OP mentioned > above, you could just limit the number of goroutines executed to 10% of > total cores. > > > On Saturday, 28 December 2019 18:02:08 UTC+5:3

Re: [go-nuts] Simple worker pool in golnag

2019-12-28 Thread Chris Burkert
There are Pros and Cons for everything in life. Some time ago I wrote a database tool which does something per table where the runtime largely depends on the table size. I started with one goroutine per table because it was easy. But that put a high load on the database (the task was to limit the

Re: [go-nuts] How to execute a command using root?

2019-08-31 Thread Chris Burkert
Dear Kevin, is there some code available to dig into that? I plan to do something similar that a regular user process starts up a kind of a root broker which starts several other processes as different users. Especially for the communication part I don’t have a good and secure idea so far. thanks

[go-nuts] Re: the Dominance of English in Programming Languages

2019-05-04 Thread Chris Burkert
they are intrinsically motivated the English language is not a hurdle for them. That’s why I was wondering about the article. Thanks for all your comments. Reading the different perspectives about the topic fascinates me a lot. Chris Burkert schrieb am Mo. 29. Apr. 2019 um 07:35: > I recently read an arti

[go-nuts] the Dominance of English in Programming Languages

2019-04-28 Thread Chris Burkert
I recently read an article (German) about the dominance of English in programming languages [1]. It is about the fact that keywords in a language typically are English words. Thus it would be hard for non English speakers to learn programming - argue the authors. I wonder if there is really

Re: [go-nuts] Different Languages of a Program Project

2019-03-04 Thread Chris Burkert
John, the Web Browser communicates with the Web Server using the http protocol. So http is the definition how they interact with each other. It’s not a language but a protocol. The Web Browser can display (or render) stuff which has been transferred via http. This could be some HTML with the help

Re: [go-nuts] Good metaphor for differentiating Go from other languages?

2019-02-23 Thread Chris Burkert
For me Go is the small but complete toolbox you need to build anything. Tim Allens Home Improvement and Binford comes to my mind :-) Randall O'Reilly schrieb am Sa. 23. Feb. 2019 um 05:40: > On the topic of “selling” the advantages of Go vs. other languages such as > Python and C++, has anyone

Re: [go-nuts] Are defered function calls executed?

2019-01-03 Thread Chris Burkert
In case of a non-nil error Close will not be executed and that is exactly what you want. The power of defer becomes obvious with more code after the defer which does not have to deal with any cleanup of previous steps because of the defer. Am Fr., 4. Jan. 2019 um 07:09 Uhr schrieb 伊藤和也 : > In

Re: [go-nuts] What are the reasonable reasons to use pointers?

2019-01-01 Thread Chris Burkert
Pointers are useful to pass around shared state. Values are usually copied so changes on one copy are not visible on the other. Pointers on the other hand are an address to some value (and the address is also copied by passing it around) but the value these addresses point to is exactly one same

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
cause the logger was slow > > For the performance aspect, you are essentially increasing the > parallelism, since any “block/wait” degrades this > > Hope that helps. > > > > On Dec 18, 2018, at 1:49 PM, Chris Burkert > wrote: > > Robert, > it seems to me t

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
be you are not and it s up to you to work around. > This becomes a problem when the code can t be rationalized via an api that > is able to wrap those behaviors. > > On Tuesday, December 18, 2018 at 8:50:20 PM UTC+1, Chris Burkert wrote: >> >> Robert, >> it seem

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
rker) > for i := 0; i < worker; i++ { > go do(i, rc, dc) > } > for done < worker { > r := <-rc > fmt.Println(r) > <-dc > done++ > } > } > > > On Tue, Dec 18, 2018 at 5:35 AM Chris Burkert > wrote: > >> Dear all, >> >> I have a couple

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
correct me if I am wrong. Chris Justin Israel schrieb am Di. 18. Dez. 2018 um 19:08: > > > On Wed, Dec 19, 2018, 5:31 AM Chris Burkert > wrote: > >> Hello Ian, all, >> yes, the workers generate multiple results. I was able to use your >> proposal with t

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
} } return n } Am Di., 18. Dez. 2018 um 15:50 Uhr schrieb Ian Lance Taylor : > On Tue, Dec 18, 2018 at 5:35 AM Chris Burkert > wrote: > > > > I have a couple of goroutines sending multiple results over a channel - > a simple fan-in. They signa

[go-nuts] Channels: selecting the last element

2018-12-18 Thread Chris Burkert
Dear all, I have a couple of goroutines sending multiple results over a channel - a simple fan-in. They signal the completion on a done channel. Main selects on the results and done channel in parallel. As the select is random main sometimes misses to select the last result. What would be the

Re: [go-nuts] Force pointer at compile time to interface{} parameter

2018-11-19 Thread Chris Burkert
Hello Hay, with interface{} you explicitly allow everything. Instead you may consider to restrict the accepted input in the first place - e.g. with a non-empty interface. Chris hay schrieb am Mo. 19. Nov. 2018 um 15:37: > Hi, > > I've the following example code of correct version. > > func

Re: [go-nuts] Directory Structure in Markdown Synax

2018-10-29 Thread Chris Burkert
Maybe episode #35 from justforfunc (https://youtu.be/XbKSssBftLM) answers what you’re searching for. Alex Dvoretskiy schrieb am Mo. 29. Okt. 2018 um 20:21: > Looking for a Go code or algorithm, in general, to print out directory > structure. > > Example: https://jekyllrb.com/docs/structure/ > >

Re: [go-nuts] cgo and time.After

2018-05-20 Thread Chris Burkert
t from %d\n", remaining, amount) case <-donChan: remaining-- case res := <-resChan: fmt.Println(res) } } thanks all! Chris On Saturday, May 19, 2018 at 9:16:19 PM UTC+2, Jakob Borg wrote: > > On 19 May 2018, at 16:25, Chris

Re: [go-nuts] cgo and time.After

2018-05-19 Thread Chris Burkert
at 16:25, Chris Burkert <burkert.ch...@gmail.com> wrote: > > > > case <-time.After(5 * time.Second): > > fmt.Printf("Progress: %d left from %d\n", remaining, amount) > > It's not super clear from your post if you're aware of this already, but

[go-nuts] cgo and time.After

2018-05-19 Thread Chris Burkert
Dear Gophers, I am working on a small database tool which checks a database for inconsistencies. It does that by calling a stored procedure via sql. Unfortunately the database client is available as C-library only but luckily there is a go driver for the database/sql package so at least it