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

2019-08-30 Thread Benjamin
Yes, it works. Thank you very much! 在 2019年8月30日星期五 UTC+8下午2:56:50,Jakob Borg写道: > > On 30 Aug 2019, at 08:49, Benjamin > > wrote: > > > Then I tried to use "sudo" to execute the command, but the environment > variables can't be carried over into the command;

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

2019-08-30 Thread Benjamin
Hi, I need to execute a couple of commands in golang, the code is roughly as below, cmd := exec.Command(executable, newArgs...) if env != nil && len(env) > 0 { cmd.Env = env } outMsg, err := cmd.CombinedOutput() if err != nil { .. } Executing the

[go-nuts] Questions related to mock exec.Command in unit test

2019-09-05 Thread Benjamin
Currently I am using the following code to mock the exec.Command. But there are two issues: 1. I expect the code being tested gets the expected output message (value of the variable 'msg') from STDOUT, but actually what it gets from STDOUT is always "PASS", which should be the output of the

Re: [go-nuts] why "unsafe.Sizeof(a[0])" doesn't generate panic when a is nil

2020-07-27 Thread Benjamin
ase you mention, but `a` might also be dynamic). And there is > little use in having it panic - at the end of the day, what it does is > still pretty well-defined. > So, panicing would require a) extra work (both in spec and implementation) > and b) be strictly less useful. So why should it?

[go-nuts] why "unsafe.Sizeof(a[0])" doesn't generate panic when a is nil

2020-07-27 Thread Benjamin
The code is something like below, the a is a nil slice. I am curious why it doesn't generate panic. Could anyone educate me on this? Thanks. var a []int fmt.Println(unsafe.Sizeof(a[0])) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: Where can I get a complete list of enhancements or changes of the golang spec (Version of Feb 10, 2021) agaisnt previous (Version of Jan 14, 2020)

2021-06-14 Thread Benjamin
ote: > >> For your convenience: https://pastebin.pl/view/308d1b73 >> >> On Sat, Jun 12, 2021 at 5:15 PM 'Carla Pfaff' via golang-nuts < >> golan...@googlegroups.com> wrote: >> >>> On Saturday, 12 June 2021 at 16:53:01 UTC+2 Benjamin wrote: >>&g

[go-nuts] Where can I get a complete list of enhancements or changes of the golang spec (Version of Feb 10, 2021) agaisnt previous (Version of Jan 14, 2020)

2021-06-12 Thread Benjamin
Previously it took a long time to read through the golang spec of version of Jan 14, 2020. The newest golang spec is Version of Feb 10, 2021. I really don't want to read through all the spec again. Is there a summary on the changes between the two versions? Thanks. -- You received this

[go-nuts] Re: Can write data and sync a removed file

2021-12-08 Thread Benjamin
I tested the program on both Linux and Mac, and the behavior is consistent. Makes sense, Looks like an expected behavior. Thanks. Just paste the program as below, package main import ( "fmt" "os" ) func main() { f, err := os.OpenFile("/tmp/db", os.O_RDWR | os.O_CREATE, 0666) if err != nil

[go-nuts] Can write data and sync a removed file

2021-12-07 Thread Benjamin
The code is pretty simple, see below [image: Screen Shot 2021-12-08 at 1.23.19 PM.png] I added breakpoints at line 18. I manually removed the file /tmp/db, and then continued to run the file. Everything was working well. Is this a bug or expected behavior? -- You received this message

[go-nuts] Re: How to manage a web portal with multiple services without stopping and restarting everything at each release/fix?

2016-06-21 Thread Benjamin Measures
On Thursday, 16 June 2016 16:02:50 UTC+1, romano.p...@gmail.com wrote: > > In Layman terms, if I had a portal in php I could (of course it depends on > situations) simply replace the pages of the module for the Service 1 > without the need to stop everything (not only Service 2,3,4 and so on but

[go-nuts] Re: How to manage a web portal with multiple services without stopping and restarting everything at each release/fix?

2016-06-21 Thread Benjamin Measures
On Sunday, 19 June 2016 09:53:34 UTC+1, Simon Ritchie wrote: > > Whichever you choose, it will not be as good as PHP in some respects and I > predict that speed of redeployment will be one of them. > When deploying to hundreds of servers, deploying hundreds of files to each becomes

Re: [go-nuts] Re: General question: complex search form and query params

2018-03-03 Thread Benjamin Thomas
> Matt > > On Friday, March 2, 2018 at 12:38:23 PM UTC-6, Benjamin Thomas wrote: >> >> I believe correctly used database/sql (with the argument placeholders) >>> protects against SQL injection >>> >> >> Yeah I badly explained this, an SQL builde

Re: [go-nuts] [generics]The ability to allow different length arrays and slices

2020-07-21 Thread benjamin . zarzycki
Clearly that's a workaround though. Like how you can copy a slice of bytes without calling copy by casting it to a string and then back to []bytes. It gets the job done, but it's weird and not obvious. On Wednesday, July 15, 2020 at 12:14:19 PM UTC-7, Axel Wagner wrote: > > Why not just

Re: [go-nuts] problem with "goroutine" binding "m"

2022-07-23 Thread Benjamin Yim
Thanks. Ian Lance Taylor 于2022年7月23日周六 22:30写道: > > On Sat, Jul 23, 2022, 7:24 AM Benjamin Yim wrote: >> >> If I want to bind "goroutine" to "m" and run it. What are the more demanding >> issues I should need to consider? >> priority? Deadlocks

[go-nuts] problem with "goroutine" binding "m"

2022-07-23 Thread Benjamin Yim
If I want to bind "goroutine" to "m" and run it. What are the more demanding issues I should need to consider? priority? Deadlocks? Performance? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] What is "pclntab's format"

2022-08-21 Thread Benjamin Yim
?, 0xf4d7000?}) /Users/benjamin/Documents/github.com/go/src/runtime/panic.go:1047 +0x5d fp=0x7ff7bfeff7a8 sp=0x7ff7bfeff778 pc=0x103195d runtime.moduledataverify1(0x7ff70002?) /Users/benjamin/Documents/github.com/go/src/runtime/symtab.go:607 +0x816 fp=0x7ff7bfeff8a8 sp=0x7ff7bfeff7a8 pc

[go-nuts] Re: General question: complex search form and query params

2018-03-02 Thread benjamin . guy . thomas
this, but first I'd like >> to make sure I'm not going to reinvent the wheel :) > > > It sounds like you are reinventing SQL. Why do you need a DSL? > > Matt > > On Friday, March 2, 2018 at 7:45:19 AM UTC-6, Benjamin Thomas wrote: >> >> Hello gophers, >>

Re: [go-nuts] General question: complex search form and query params

2018-03-02 Thread benjamin . guy . thomas
Thanks for the feedback. I'm only vaguely familiar with graphql. From my understanding, it's meant to facilitate data query for the frontend dev. But I'm looking at things more from a user perspective here, see my github example. I might have to dig into this though. Le vendredi 2 mars 2018

[go-nuts] General question: complex search form and query params

2018-03-02 Thread benjamin . guy . thomas
Hello gophers, Sorry if this is considered noise to some, as I have a question which is not specifically go related. I have a personal project in which I'd like to use go though. Basically, I'd like to create a complex search form, returning data backed by an SQL database. To prevent SQL

Re: [go-nuts] Where is the version number for a golang module declared?

2020-03-12 Thread 'Benjamin' via golang-nuts
Go programming language has no version mechanism. Like java jar files that contains class files. If you want to use special version, the version can be included in the import path > On Mar 11, 2020, at 13:32, Tamás Gulácsi wrote: > > AFAIK tags are for concrete version (vMajor.Minor.Patch),

Re: [go-nuts] Consume RESTful API Endpoints within a golang application with webtoken

2020-03-11 Thread 'Benjamin' via golang-nuts
Easy, Store the expired time in the token, and hash them. When the expired time almost reach, use the old token to get a new token. > On Mar 12, 2020, at 09:25, Renato Marcandier > wrote: > > Hello guys, > do you have any HelloWorld project in GO using RESTful to issue HTTP requests > from

Re: [go-nuts] SFTPGo: a Golang performance story and some questions

2020-03-11 Thread 'Benjamin' via golang-nuts
I think that’s why go should be driven by the community but not by Bell labs nor Google labs. Works in Bell Labs or Google Labs may leave the job, and may not know everything. But the community have enough Human Resources and various of knowledges. Some scientists and reaserchers worked for

Re: [go-nuts] SFTPGo: a Golang performance story and some questions

2020-03-11 Thread 'Benjamin' via golang-nuts
worked for capitalists. > On Mar 11, 2020, at 20:58, 'Benjamin' via golang-nuts > wrote: > > I think that’s why go should be driven by the community but not by Bell labs > nor Google labs. > Works in Bell Labs or Google Labs may leave the job, and may not know > everything. >

Re: [go-nuts] How to break-out of martini middleware

2020-03-14 Thread 'Benjamin' via golang-nuts
I don’t need to read the stackoverflow. And I don’t know martini. Middlewares and Handler are all can break the pipeline of http request. If martini is not designed like this, it is not well designed. Maybe the authors of martini do not have real production software expriences. Big companies like

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

2020-03-16 Thread 'Benjamin' via golang-nuts
I find a project that is very interesting, https://github.com/yyzybb537/libgo How do you all think about it? -- 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] libgo is more fast that grouting.

2020-03-18 Thread 'Benjamin' via golang-nuts
n some idea from these projects. NOT invent new thing is not necessary, its waste of time. Not all developers have 10+ years time to wait a new programming language become maturity . > On Mar 17, 2020, at 12:23, wagner riffel wrote: > > On Mon, 16 Mar 2020 20:13:10 +0800 > "'Be

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

2020-03-19 Thread 'Benjamin' via golang-nuts
. > On Mar 19, 2020, at 00:00, Ian Lance Taylor wrote: > > On Tue, Mar 17, 2020 at 11:12 PM 'Benjamin' via golang-nuts > wrote: >> >> Benchmark shows that lingo is faster than goroutine. >> >> Many china internet companies use similar c++ libraries to support t

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

2020-03-21 Thread 'Benjamin' via golang-nuts
er are research projects. So please don’t whine about how > things are. Instead (as Ian said) participate in a positive manner and > contribute to make things better. The code of conduct is a good starting > point: https://golang.org/conduct <https://golang.org/conduct> &

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

2020-03-22 Thread 'Benjamin' via golang-nuts
WOW,only children from poor families do programming work. > On Mar 21, 2020, at 17:41, Dan Kortschak wrote: > > Please stop. > > > On Sat, 2020-03-21 at 17:20 +0800, 'Benjamin' via golang-nuts wrote: >> Tesla is commodity, but a programming language is not. >&g

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

2020-03-22 Thread 'Benjamin' via golang-nuts
, they do not think they engineers. Android is widely used, But android is bought from other companies. Only engineers can produce well designed production. Scientists or. researchers worked like students. > On Mar 22, 2020, at 16:21, Benjamin wrote: > > WOW,only children from poor fa