Re: [go-nuts] Fscan() eats 1st char in scanning values

2025-01-27 Thread Howard C. Shaw III
In your example, you are repeatedly reading one 'item' from the line. This is the source of the confusion, as this is not how Fscanln works - when you do this, *each* item is the documented 'final item' after which there must be a newline. That is, your data would look more like this: space sep

[go-nuts] Re: Go i18n printer directly in templates?

2024-12-09 Thread Howard C. Shaw III
The x packages parse the .go files and work on the parsed tree of a specified package - so they see only what is visible at the go compiler level, and never see what is in templates that are outside of the go files. Here is a StackOverflow on this topic, which suggests a library that does suppo

[go-nuts] Re: Rendering fonts in Go

2023-12-22 Thread Howard C. Shaw III
I think Freetype may still be your best bet - but rather than the Freetype port, you would need to use a wrapper that calls the Freetype C library, such as https://github.com/danielgatis/go-freetype -- You received this message because you are subscribed to the Google Groups "golang-nuts" grou

Re: [go-nuts] go1.21.0 panics when loading plugin

2023-09-05 Thread Howard C. Shaw III
It looks to me like the regexp package has an func init() that never gets called when Re is only imported in a plugin, which is why it works when you uncomment the lines that use regexp in the main package. Howard -- You received this message because you are subscribed to the Google Groups "g

[go-nuts] Re: Download large Zip file via sftp

2023-09-05 Thread Howard C. Shaw III
I want to second what Ozan has said, use *sftp.Client not sftp.Client, but I want to throw out a couple of words about that. First, the documentation specifically warns against copying Mutex. So you need to be fairly certain that no mutexes are used in a struct before using value semantics. An

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-14 Thread Howard C. Shaw III
Such an issue is what I linked you to earlier in the thread. So I do not think you need to create a new issue - however, in the comments in that issue one of the devs asks for use cases where go work sync is not sufficient, so you might want to reply to that with your example where go work sync

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Howard C. Shaw III
Okay, yeah, got home and tried it out, and go work sync is not doing what I thought it was. I had to do go get github.com/janpfeifer/gonb/gonbui in a to get it to build and run. So yeah, if you want to use a bare go get, you have to do replace directives. Blech. -- You received this message

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Howard C. Shaw III
I'm not suggesting that it would fix go get, but that it replaces it. Add your extra third party reference, then do go work sync and it should download that dependency. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Howard C. Shaw III
Also did you call go work sync? I think that might be what I actually use in place of go mod tidy. Sorry, ToTK has been absorbing my free time, so it has been a while since I worked on the audio project where I used workspaces. https://github.com/golang/go/issues/50750 "*bcmills

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Howard C. Shaw III
What directory did you do the go work init in? The setup description reads like you did it in work/a - shouldn't it be in /work? Can you check where your go.work file is? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Howard C. Shaw III
I don't think you need to run go get there at all - just run go mod tidy, and then when you go build, if it needs something it will get it. If you need to download without building, go mod download will do that. Howard -- You received this message because you are subscribed to the Google Group

[go-nuts] Re: Modules... why it has to be so painfull?

2023-05-19 Thread Howard C. Shaw III
Workspaces make this all much easier for me. https://go.dev/doc/tutorial/workspaces go work I was going mad trying to get modules to work reasonably until I found that. Now, new directory, go mod init , go work use ., go work sync, go tidy, and everything works reasonably without major headache

[go-nuts] Re: Why can't a regexp.Regexp be const

2023-02-14 Thread Howard C. Shaw III
var ExtRegex = regexp.MustCompile("(M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$") with a ./prog.go:10:18: regexp.MustCompile("((M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$") (value of type *regexp.Regexp) is not constant Actual error I get is "error parsing regexp: unexpected ): `(M|m)(p|P)(3|4))|(

[go-nuts] Re: Endless Running Goroutine Terminates Without Panic

2023-01-27 Thread Howard C. Shaw III
Ctrl-\ in a Linux terminal sends the SIGQUIT signal. You can also send this signal with kill. Sending SIGQUIT to a golang application (unless it traps it and changes the behavior) will cause it to print all of its goroutine's stack traces and then exit. Perhaps you could use this to confirm th

[go-nuts] Re: How to get name of variable name from pointer name?

2022-08-30 Thread Howard C. Shaw III
In the instant example where you have the name in the code, just include the name as a string: fmt.Printf("Type: %T, Name:%#+v\n", myVariable, "myVariable") But in the general case where that pointer value has been passed to a function or stored in a map or slice and you are referencing

[go-nuts] Re: Microsoft Adaptive card

2022-07-22 Thread Howard C. Shaw III
I'm not really sure how Go relevant this is - but the Adaptive project on GitHub says the license is MIT, so even if the project folds, you could just fork it. https://github.com/microsoft/AdaptiveCards/blob/main/LICENSE Given that the rendering is a client-side thing, couldn't you use the Javas

[go-nuts] Re: find hwnd on win 10

2022-06-26 Thread Howard C. Shaw III
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow "The system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true: - The process is the foreground process.

[go-nuts] Re: Concurrent solution: Which is the most efficient way to read STDIN lines 100s of MB long?

2022-06-21 Thread Howard C. Shaw III
There seems to be a conflict between these two statements: > should output every line that contains a search word "test" to STDOUT. and > If one goroutine finds it I can stop the other 7 from working. If it is supposed to output EVERY line containing test, what is the logic that says you can

[go-nuts] Re: find hwnd on win 10

2022-06-21 Thread Howard C. Shaw III
On what basis are you using globs ("*lient*", etc) in FindWindow? If I understand correctly, the w32 and w32a packages are just wrapping Windows APIs, so the semantics of the use should match the equivalent use of the windows API. The documentation for FindWindow says "Retrieves a handle to the

[go-nuts] Re: Drawing millions of images on a bigger canvas

2022-01-24 Thread Howard C. Shaw III
One more options to add to Tamás' suggestions - due to Go's interface design, implementing a draw.Image, which is an image.Image with an additional Set(x, y int, c color.Color) method, is sufficient to use draw.Draw for compositing. As such, you can pre-allocate a flat-file with sufficient spa

[go-nuts] Re: profiling help

2022-01-12 Thread Howard C. Shaw III
The 17% is sleeping. The 70% is garbage collection. On Wednesday, January 12, 2022 at 3:54:32 PM UTC-6 st...@rothskeller.net wrote: > I am attempting to profile my code, and I'm unable to interpret the > results. So first, the meta-question is, what's the best forum to use to > request help w

[go-nuts] Re: generics: what can we do with an any type?

2021-12-16 Thread Howard C. Shaw III
The code you wrote is using a generic value, but it is not itself generic. There is only one instantiated version of the runInt() function, and it knows (at compile-time!) that mySet is an map[int]int. Make that function actually generic - something like: func testThing[K comparable, V any](m ma

Re: [go-nuts] What is the total max size of embed content?

2021-09-22 Thread Howard C. Shaw III
Before the addition of binary packaged assets into Go as a standard library feature, there were various tools to accomplish the same task. Some of them, such as https://github.com/GeertJohan/go.rice , could use an alternate embedding. Basically, instead of having the binary files packaged as Go

[go-nuts] Re: I just published : Iterator lib for Go: Library providing Map(), Filter(), Reduce() for Go

2021-09-03 Thread Howard C. Shaw III
Just so you are aware of what's out there: https://github.com/robpike/filter "I wanted to see how hard it was to implement this sort of thing in Go, with as nice an API as I could manage. It wasn't hard. Having written it a couple of years ago, I haven't had occasion to use it once. Instead, I

Re: [go-nuts] Re: fonts, bitmap and the (old TeX) PK file format

2021-09-01 Thread Howard C. Shaw III
Cool. As to the Postscript interpreter, look at https://github.com/llgcode/ps Also, font specific https://github.com/golang/image/blob/master/font/sfnt/postscript.go Not sure how much either helps towards Type 1 support. Even Adobe is end of lifing Type 1 support, though, so it might be wort

[go-nuts] Re: fonts, bitmap and the (old TeX) PK file format

2021-09-01 Thread Howard C. Shaw III
You would implement the Face interface to have your fonts available to Go's text drawing routines. You can try using basicfont directly, however it is fixedwidth only. But just implementing the interface does not seem that onerous. Have a look at https://github.com/hajimehoshi/bitmapfont for a

[go-nuts] Re: It's possible to replace cgo memory allocator?

2021-06-10 Thread Howard C. Shaw III
The DGraph.io team has a blog post about swapping to using jemalloc for CGo (they are going further and feeding their allocations into Go to avoid garbage collection, but that is a separate issue). https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc/ On Thursday, June 10, 2021

[go-nuts] Re: What are the analogues of PostCSS for go

2021-05-27 Thread Howard C. Shaw III
Take this with a grain of salt, as I've never used PostCSS and had to look up what it even was. https://github.com/ysugimoto/gssp - this is Golang Style Sheet Postprocessor which appears to be at least directed at the same task. Of course, as PostCSS is a tool that applies to .css files, there

[go-nuts] Re: Map to struct and vice versa

2021-05-17 Thread Howard C. Shaw III
The examples given in other responses are great if you need to handle arbitrary or unknown maps and very much fit the 'easy way' part of your initial question. But you also asked at the end 'is there a more direct way?'. If you actually know what you are getting, you can code it entirely direc

Re: [go-nuts] time.Format with "Month Year" format incorrectly displayed

2021-05-06 Thread Howard C. Shaw III
Alternatives: Excel style formatter: https://github.com/metakeule/fmtdate bday, err := fmtdate.NewTimeDate("-MM-DD", "2000-12-04") C-library style formatter: https://github.com/lestrrat-go/strftime https://github.com/fastly/go-utils/strftime -- deprecated https://github.com/jehiah/go-strftime

[go-nuts] Re: I'd like to write a CSS StyleSheet Parser but...

2021-01-04 Thread Howard C. Shaw III
An AST (Abstract Syntax Tree) is exactly what the common output of a parser is, and you can see an example of it in the Go source code. But not always - the output of a parser can also be function calls, as in a streaming XML (SAX) style parser. The important elements of a parser is that it kn

[go-nuts] Re: JSON dictionary encoding

2021-01-04 Thread Howard C. Shaw III
It is not JSON at that point - and if you want a JSON compatible format that compresses, well, there are dozens of them - some just elide the keynames, others include compression of the data elements as well. Here is an article discussing a lot of them: https://www.lucidchart.com/techblog/2019

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

2021-01-04 Thread Howard C. Shaw III
I posted two real world problems where Generics would be useful to me, earlier in the thread. Saw no response, and now continued claims that no real world problems have been provided? I'm not sure if that is disingenuous, or merely an artifact of the client someone is using causing replies that

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

2020-12-24 Thread Howard C. Shaw III
I do not have an example implemented with generics, but I do have examples that could use them. My renderview - https://github.com/TheGrum/renderview ; in particular this file: https://github.com/TheGrum/renderview/blob/master/renderparameter.go and my still unpublished audio library, visible i

[go-nuts] Re: Command line tool to modify YAML files

2020-11-02 Thread Howard C. Shaw III
If written because you needed experience and writing a program to perform a task you need done is better for learning, then go you! But if you are legitimately looking to solve a problem, you might want to throw a quick search out first before implementing Yet Another X. For yamlfukr update fil

Re: [go-nuts] Question on the generics proposal and arrays

2020-10-07 Thread Howard C. Shaw III
You said: > I was trying around with arrays and generics because slices are more > complex to reason about than arrays. For example, I introduced bugs into my > code by not being fully aware of slices overwriting original data when you > append to them and the capacity is not set correctly. So