[go-nuts] Re: Go modules replace statements referencing legacy codebases

2020-11-06 Thread Jim Minter
Sadly not.  Doing this doesn't cause an error, but it also doesn't change 
the relevant replace directive in the go.mod file.

Jim

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5263b733-12e8-48bd-97d1-b24d40928baan%40googlegroups.com.


Re: [go-nuts] strconv.ParseFloat panic

2020-11-06 Thread 'Dan Kortschak' via golang-nuts
OK, so you're not using Cgo, that leaves some other unsafe use, a data
race or unlikely some weird compiler bug.

I'd start looking in api.handleDPriceRange to see where the string
input to strconv.ParseFloat is being constructed.

On Fri, 2020-11-06 at 01:10 -0800, blade...@gmail.com wrote:
> go version is 1.15 , cross compile on darwin  and run on linux,  i
> will try to run with race deector
> 
> 
> 
> 在2020年11月6日星期五 UTC+8 下午4:34:21 写道:
> > The full panic would help, but somehow you have a string with a
> > nil 
> > pointer that is 4 bytes long. Where is the string generated? Are
> > you 
> > using Cgo? Have you run with the race detector? Also, what version
> > of 
> > Go are you using? 
> > 


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/dc04cd21bb00f2e520f9791fdad6c1731c85a8a2.camel%40kortschak.io.


[go-nuts] Re: Go modules replace statements referencing legacy codebases

2020-11-06 Thread seank...@gmail.com
I think you should be able to do `go get ./... dep1@branchA dep2@branchB 
...`
On Friday, November 6, 2020 at 3:20:16 PM UTC+1 Jim Minter wrote:

> Hi,
>
> Using Go 1.14, I'm working on a parent codebase which, in its go.mod 
> file, has a number of replace statements referencing legacy child 
> codebases which have not yet converted to Go modules.
>
> At this stage the legacy child codebases handle versioning by branch, 
> rather than using semantic versioning, so my go.mod file has a number of 
> statements like these:
>
> > replace github.com/foo/bar => github.com/foo/bar 
> v0.0.0-2020xx- // should track branch baz
> > replace github.com/foo/bar1 => github.com/foo/bar1 
> v0.0.0-2020yy- // should track branch baz
>
> My goal is to be confident that if I update dependencies in the parent 
> codebase (go get -u ./...), I'll be pulling in HEAD on the relevant 
> branch of all the legacy child dependencies.
>
> My expectation is that this is a transitional use case because 
> eventually the child codebases will migrate to Go modules, but until 
> then, it's important to me to know I will pull in critical fixes from 
> the child dependencies if they happen.
>
> The difficulty I've got is ensuring that the replace stanzas are valid 
> and up-to-date. I'm not finding a great way to do this with the Go 
> module tooling and I wonder if I'm missing anything. Here are the 
> feasible ugly alternatives I've found so far:
>
> 1. Child by child, abuse the fact that `go mod tidy` rightly or wrongly 
> seems to tolerate a single legacy branch reference in the file at a time 
> and rewrites it to the v0.0.0-2020xx- format:
>
> > go mod edit -replace github.com/foo/bar=github.com/foo/bar@baz
> > go mod tidy
> > go mod edit -replace github.com/foo/bar1=github.com/foo/bar1@baz
> > go mod tidy
> > ...etc...
> > go get -u ./...
>
> 2. A script to be run manually (or via go generate? yikes!) before 
> running go get -u ./..., containing abominations like this:
>
> > go mod edit -replace github.com/foo/bar=$(go list -mod=mod -m 
> github.com/foo/bar@baz | sed -e 's/ /@/')
> > go mod edit -replace github.com/foo/bar1=$(go list -mod=mod -m 
> github.com/foo/bar1@baz | sed -e 's/ /@/')
> > ...etc...
> > go get -u ./...
>
> 3. Alternative abominations like this:
>
> > go mod edit -replace github.com/foo/bar=github.com/foo/bar $(curl -s 
> https://proxy.golang.org/github.com/foo/bar/@v/baz.info | jq -r .Version)
> > go mod edit -replace github.com/foo/bar1=github.com/foo/bar1 $(curl -s 
> https://proxy.golang.org/github.com/foo/bar1/@v/baz.info | jq -r .Version)
> > ...etc...
> > go get -u ./...
>
> I'm wondering: is there a better way? Should there be?
>
> Many thanks!
>
> Jim Minter
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/147a99cd-4c81-45e6-903a-a9813e891037n%40googlegroups.com.


[go-nuts] Go modules replace statements referencing legacy codebases

2020-11-06 Thread Jim Minter

Hi,

Using Go 1.14, I'm working on a parent codebase which, in its go.mod 
file, has a number of replace statements referencing legacy child 
codebases which have not yet converted to Go modules.


At this stage the legacy child codebases handle versioning by branch, 
rather than using semantic versioning, so my go.mod file has a number of 
statements like these:



replace github.com/foo/bar => github.com/foo/bar 
v0.0.0-2020xx- // should track branch baz
replace github.com/foo/bar1 => github.com/foo/bar1 
v0.0.0-2020yy- // should track branch baz


My goal is to be confident that if I update dependencies in the parent 
codebase (go get -u ./...), I'll be pulling in HEAD on the relevant 
branch of all the legacy child dependencies.


My expectation is that this is a transitional use case because 
eventually the child codebases will migrate to Go modules, but until 
then, it's important to me to know I will pull in critical fixes from 
the child dependencies if they happen.


The difficulty I've got is ensuring that the replace stanzas are valid 
and up-to-date.  I'm not finding a great way to do this with the Go 
module tooling and I wonder if I'm missing anything.  Here are the 
feasible ugly alternatives I've found so far:


1. Child by child, abuse the fact that `go mod tidy` rightly or wrongly 
seems to tolerate a single legacy branch reference in the file at a time 
and rewrites it to the v0.0.0-2020xx- format:



go mod edit -replace github.com/foo/bar=github.com/foo/bar@baz
go mod tidy
go mod edit -replace github.com/foo/bar1=github.com/foo/bar1@baz
go mod tidy
...etc...
go get -u ./...


2. A script to be run manually (or via go generate? yikes!) before 
running go get -u ./..., containing abominations like this:



go mod edit -replace github.com/foo/bar=$(go list -mod=mod -m 
github.com/foo/bar@baz | sed -e 's/ /@/')
go mod edit -replace github.com/foo/bar1=$(go list -mod=mod -m 
github.com/foo/bar1@baz | sed -e 's/ /@/')
...etc...
go get -u ./...


3. Alternative abominations like this:


go mod edit -replace github.com/foo/bar=github.com/foo/bar $(curl -s 
https://proxy.golang.org/github.com/foo/bar/@v/baz.info | jq -r .Version)
go mod edit -replace github.com/foo/bar1=github.com/foo/bar1 $(curl -s 
https://proxy.golang.org/github.com/foo/bar1/@v/baz.info | jq -r .Version)
...etc...
go get -u ./...


I'm wondering: is there a better way?  Should there be?

Many thanks!

Jim Minter

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/922448f0-00cf-7f7e-efdc-50965aefc6d4%40minter.uk.


Re: [go-nuts] strconv.ParseFloat panic

2020-11-06 Thread blade...@gmail.com
go version is 1.15 , cross compile on darwin  and run on linux,  i will try 
to run with race deector



在2020年11月6日星期五 UTC+8 下午4:34:21 写道:

> The full panic would help, but somehow you have a string with a nil
> pointer that is 4 bytes long. Where is the string generated? Are you
> using Cgo? Have you run with the race detector? Also, what version of
> Go are you using?
>
> On Fri, 2020-11-06 at 00:00 -0800, blade...@gmail.com wrote:
> > i check my code, and strconv.ParseFloat(s, 64), s is a string, it is
> > correct, but after run my program for a while, it's panic and report
> > some output info. i cant't find why , anyone can help me 
> > 
> > 
> > output infor:
> > panic: runtime error: invalid memory address or nil pointer
> > dereference
> > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0
> > pc=0x4a2654]
> > 
> > goroutine 2948735 [running]:
> > strconv.special(0x0, 0x4, 0x0, 0x3ff2e147ae147ae1, 0x1)
> > strconv/atof.go:48 +0x34
> > strconv.atof64(0x0, 0x4, 0x41421d, 0xc05323c380, 0xc05dd95ab0, 0xa)
> > strconv/atof.go:612 +0x50
> > strconv.parseFloatPrefix(0x0, 0x4, 0x40, 0x3, 0xc078741b48,
> > 0xc05dd95ab0, 0xc078741b40)
> > strconv/atof.go:695 +0x95
> > strconv.ParseFloat(0x0, 0x4, 0x40, 0xa, 0xc078741bc8, 0xc05dd95a01)
> > strconv/atof.go:683 +0x45
> > xx/api.handleDPriceRange(0xc01777c820)
> > xx/api/PriceCalendar.go:1008 +0x212
> > xx/api.priceCalendarItemExpand(0xc016e34a80, 0xc96, 0xc96)
> > xx/api/PriceCalendar.go:1104 +0xb9b
> > xx/api.FlightlineRT(0xc001bd9d98, 0xc0002294f0, 0x1306020,
> > 0xc04f1415c0, 0xc05e653a70, 0x1c000229518, 0xc05193dc00)
> > xx/api/external_api.go:146 +0x108
> > xx/api.aaa.func2(0xc04f1456b0, 0xc04f102340, 0xc05d23aa68, 0x3,
> > 0xc05465c230, 0x63, 0xc04f13c301, 0x7, 0x0, 0x0, ...)
> > xx/api/external_api.go:343 +0x25b
> > created by xx/api.AppMainpage
> > xx/api/external_api.go:330 +0x57e
> > -- 
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/golang-nuts/9c672d72-7daa-4fe1-9f84-136c2eaa2065n%40googlegroups.com
> > .
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/afa99a55-f4ec-46d7-8a5f-fc981953583bn%40googlegroups.com.


Re: [go-nuts] strconv.ParseFloat panic

2020-11-06 Thread 'Dan Kortschak' via golang-nuts
The full panic would help, but somehow you have a string with a nil
pointer that is 4 bytes long. Where is the string generated? Are you
using Cgo? Have you run with the race detector? Also, what version of
Go are you using?

On Fri, 2020-11-06 at 00:00 -0800, blade...@gmail.com wrote:
> i check my code, and strconv.ParseFloat(s, 64), s is a string, it is
> correct, but  after run my program for a while, it's panic and report
> some output info. i cant't find why , anyone can help me 
> 
> 
> output infor:
> panic: runtime error: invalid memory address or nil pointer
> dereference
> [signal SIGSEGV: segmentation violation code=0x1 addr=0x0
> pc=0x4a2654]
> 
> goroutine 2948735 [running]:
> strconv.special(0x0, 0x4, 0x0, 0x3ff2e147ae147ae1, 0x1)
>   strconv/atof.go:48 +0x34
> strconv.atof64(0x0, 0x4, 0x41421d, 0xc05323c380, 0xc05dd95ab0, 0xa)
>   strconv/atof.go:612 +0x50
> strconv.parseFloatPrefix(0x0, 0x4, 0x40, 0x3, 0xc078741b48,
> 0xc05dd95ab0, 0xc078741b40)
>   strconv/atof.go:695 +0x95
> strconv.ParseFloat(0x0, 0x4, 0x40, 0xa, 0xc078741bc8, 0xc05dd95a01)
>   strconv/atof.go:683 +0x45
> xx/api.handleDPriceRange(0xc01777c820)
>   xx/api/PriceCalendar.go:1008 +0x212
> xx/api.priceCalendarItemExpand(0xc016e34a80, 0xc96, 0xc96)
>   xx/api/PriceCalendar.go:1104 +0xb9b
> xx/api.FlightlineRT(0xc001bd9d98, 0xc0002294f0, 0x1306020,
> 0xc04f1415c0, 0xc05e653a70, 0x1c000229518, 0xc05193dc00)
>   xx/api/external_api.go:146 +0x108
> xx/api.aaa.func2(0xc04f1456b0, 0xc04f102340, 0xc05d23aa68, 0x3,
> 0xc05465c230, 0x63, 0xc04f13c301, 0x7, 0x0, 0x0, ...)
>   xx/api/external_api.go:343 +0x25b
> created by xx/api.AppMainpage
>   xx/api/external_api.go:330 +0x57e
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/9c672d72-7daa-4fe1-9f84-136c2eaa2065n%40googlegroups.com
> .


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a0ebd55eb6be63355c1e44f9717a5710f78ca5a0.camel%40kortschak.io.


[go-nuts] Re: strconv.ParseFloat panic

2020-11-06 Thread Brian Candler
On Friday, 6 November 2020 08:00:32 UTC, blade...@gmail.com wrote:
>
> anyone can help me 
>

You will need to give some basic info.  At very least show the code that 
causes this crash, i.e. the code in external_api.go at line 330 with a few 
lines of context either side.  Also say what version of Go you are building 
with, and the OS you are running under.

Does your code have concurrent goroutines? Have you tried running it with 
the race detector enabled?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/59235677-e9b6-440f-9a5a-581d15b79209o%40googlegroups.com.


[go-nuts] strconv.ParseFloat panic

2020-11-06 Thread blade...@gmail.com
i check my code, and strconv.ParseFloat(s, 64), s is a string, it is 
correct, but  after run my program for a while, it's panic and report some 
output info. i cant't find why , anyone can help me 


output infor:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a2654]

goroutine 2948735 [running]:
strconv.special(0x0, 0x4, 0x0, 0x3ff2e147ae147ae1, 0x1)
strconv/atof.go:48 +0x34
strconv.atof64(0x0, 0x4, 0x41421d, 0xc05323c380, 0xc05dd95ab0, 0xa)
strconv/atof.go:612 +0x50
strconv.parseFloatPrefix(0x0, 0x4, 0x40, 0x3, 0xc078741b48, 0xc05dd95ab0, 
0xc078741b40)
strconv/atof.go:695 +0x95
strconv.ParseFloat(0x0, 0x4, 0x40, 0xa, 0xc078741bc8, 0xc05dd95a01)
strconv/atof.go:683 +0x45
xx/api.handleDPriceRange(0xc01777c820)
xx/api/PriceCalendar.go:1008 +0x212
xx/api.priceCalendarItemExpand(0xc016e34a80, 0xc96, 0xc96)
xx/api/PriceCalendar.go:1104 +0xb9b
xx/api.FlightlineRT(0xc001bd9d98, 0xc0002294f0, 0x1306020, 
0xc04f1415c0, 0xc05e653a70, 0x1c000229518, 0xc05193dc00)
xx/api/external_api.go:146 +0x108
xx/api.aaa.func2(0xc04f1456b0, 0xc04f102340, 0xc05d23aa68, 0x3, 
0xc05465c230, 0x63, 0xc04f13c301, 0x7, 0x0, 0x0, ...)
xx/api/external_api.go:343 +0x25b
created by xx/api.AppMainpage
xx/api/external_api.go:330 +0x57e

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9c672d72-7daa-4fe1-9f84-136c2eaa2065n%40googlegroups.com.