[go-nuts] Re: Go += Package Versioning

2018-02-27 Thread Daniel Theophanes
Hi Robert, you still can do that. Just add a "replace" directive in the 
local go.mod.

Please see https://research.swtch.com/vgo-tour for more details.

On Tuesday, February 27, 2018 at 1:47:40 PM UTC-8, Robert Carlsen wrote:
>
> Before with the naive GOPATH workflow and also with vendoring, it was 
> super easy for me to debug problems with and contribute to upstream 
> packages.  With vgo, I can't just cd into vendor/github.com/foo/bar to 
> test out fixes for bugs, etc.  Without vendoring I could just cd into 
> $GOPATH/src/github.com/foo/bar, test a patch - commit, push - and submit 
> a PR to the 3rd party project.  With vgo, I now have to fork+clone that 
> repository, modify my go.mod file to point to my fork, patch my clone, 
> commit and push to my fork before I can rebuild and test the patch.  Yuck.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-23 Thread Daniel Theophanes
The sample raster images look great! Right now, due to how Go statically 
links code I can't use GPL code in just about anything I use Go for.

I totally respect your license decision, but, it may be a poorer fit for 
Go...

On Sunday, April 22, 2018 at 10:41:07 AM UTC-7, Steven Wiley wrote:
>
> Hi all,
>
> I needed to write an SVG renderer; something that draws an SVG file onto 
> an image (not to be confused with an SVG generator such as SVGo). I wanted 
> to do this in native go, and not rely on wrapping pre-existing C code.
>
> The golang 2D drawing packages  I could find were not capable of rendering 
> stroked paths with joins like 'arc' or 'miter-clip', or specifying between 
> ending a stroked path as an open line or a closed loop. So, in order to 
> draw SVG 2.0  compliant stroked and 
> dashed-stroked paths, I refactored and enhanced the raster package from  
> the golang translation of freetype, used 
> by many of the 2D packages, into a new package; rasterx 
> . More information on the 
> refactorization is available in the readme.
>
> The SVG renderer, oksvg , processes 
> only a basic sub-set of the SVG specification, but it is capable of 
> faithfully rendering many, probably most, but certainly not all, of the 
> free and commercial SVG icons available. I have been focusing on just the 
> basics the path functions, and many elements like defs, gradients, or 
> animations have not been added at this point. However, the full SVG 2.0 
> path specification is implemented and even exceeded, since rasterx can 
> perform additional path functions that are not described by the SVG 2.0 
> specification. Also, when an SVG file is parsed, oksvg can be set to 
> ignore, log, or error-out when reading an unrecognized SVG element.
>
> So now we can render a large set of SVG icons in native go! I hope some of 
> you find this useful. Please check it out and let me know what you think. 
> The image below demonstrates the effect of some of the available joining 
> and capping functions.
>
> Cheers!
>
>
> [image: TestShapes.png] 
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-28 Thread Daniel Theophanes
Thank you for looking into this! This looks great!

-- 
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://groups.google.com/d/optout.


[go-nuts] database/sql/driver: how to return *sql.Rows?

2018-09-22 Thread Daniel Theophanes
I'm sorry, I've been meaning to reply. I'll do so tonight if I can.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: discuss database/sql feature request: add ability to retrieve driver.Driver by registered driver name.

2018-11-01 Thread Daniel Theophanes
Driver name issue: https://golang.org/issue/12600
But I think I would prefer to solve: https://golang.org/issue/18080

Now with connectors (sql.OpenDB) drivers may not have a "name".

I would love a working proposal that would take the place of ocsql, or at 
least provide it hooks to work without wrapping it.

On Friday, September 21, 2018 at 6:32:40 AM UTC-7, Bas Van Beek wrote:
>
>
> The preferred method of working with database/sql is to use registered 
> driver names to identify which driver to use for connecting to the database.
>
> OpenCensus  now has instrumentation for 
> database/sql by allowing database drivers to be wrapped with the ocsql 
>  package.
>
> The most idiomatic way to set-up ocsql 
>  is to do something 
> like this:
>
> import (
> _ "github.com/mattn/go-sqlite3"
> "github.com/opencensus-integrations/ocsql"
> )
>
> var (
> driverName string
> errerror
> db *sql.DB
> )
>
> // Register our ocsql wrapper for the provided SQLite3 driver.
> driverName, err = ocsql.Register("sqlite3", ocsql.WithAllTraceOptions())
> if err != nil {
> log.Fatalf("unable to register our ocsql driver: %v\n", err)
> }
>
> // Connect to a SQLite3 database using the ocsql driver wrapper.
> db, err = sql.Open(driverName, "resource.db")
>
> Unfortunately database/sql does not have a function to retrieve the 
> registered driver.Driver by its driver name, which could look like this:
>
> // DriverByName showsn an example of a function to retrieve a registered 
> driver by its name.
> func DriverByName(name string) driver.Driver {
> driversMu.Lock()
> defer driversMu.Unlock()
>
> return drivers[name]
> }
>
> So underwater ocsql  
> does the following dirty trick to retrieve the driver.Driver:
>
> func Register(driverName string, options ...TraceOption) (string, error) { 
> // retrieve the driver implementation we need to wrap with instrumentation
> db, err := sql.Open(driverName, "")
> if err != nil {
> return "", err
> }
> dri := db.Driver()
> if err = db.Close(); err != nil {
> return "", err
> }
>
> ...
>
> }
>
> The problem however is that Go 1.10 introduced the new interface 
> DriverContext which, if implemented by a database driver, will make the 
> call to sql.Open to retrieve the driver.Driver fail as it can error on the 
> call to OpenConnector:
>
> // If a Driver implements DriverContext, then sql.DB will call
> // OpenConnector to obtain a Connector and then invoke
> // that Connector's Conn method to obtain each needed connection,
> // instead of invoking the Driver's Open method for each connection.
> // The two-step sequence allows drivers to parse the name just once
> // and also provides access to per-Conn contexts.
> type DriverContext interface {
> // OpenConnector must parse the name in the same format that Driver.Open
> // parses the name parameter.
> OpenConnector(name string) (Connector, error)
> }
>
>
> If the database driver to wrap with ocsql also does not export its 
> driver.Driver implementation it will be not possible to use ocsql.
>
> Would like to hear from the Go team and community if adding a DriverByName 
> type function is acceptable given the use case presented above. It would 
> surely make ocsql less brittle and better supported.
>
> Cheers,
>
> Bas van Beek
>
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Go offline development recommendations

2018-12-13 Thread Daniel Theophanes
Hi,

Vendoring will be around a long time. Support for vendoinrg + modules is 
getting better with the 1.12 release even.

If you need to develop offline, that is the way to go. Also, vendoring is 
not a footgun. You check in your vendor directory and that ensures all 
developers and CI tools are on the exact same page.

If this situation, you either need to do per project vendoring or per 
environment vendoring like athens. Both just take similar project structure.

-Daniel


On Wednesday, December 12, 2018 at 2:19:01 PM UTC-8, snmed wrote:
>
> Hi thepudds
>
> Thanks for you Reply. Indeed vendoring is an Option, but I'm not sure how 
> long that will be supported. I think i've read about a blog post which says 
> vendoring will be remove from the go tools, but i'm not sure if this still 
> on the Roadmap of the go Team.
> I will have a look into the walkthrough you've posted and see if i get 
> some new ideas out of it.
>
> Cheers
>
> Am Mittwoch, 12. Dezember 2018 22:35:36 UTC+1 schrieb thepud...@gmail.com:
>>
>> Hi Sandro,
>>
>> Vendoring is another approach that can work here.
>>
>> In a pre-modules world, vendoring is fairly well known.
>>
>> In a modules world, vendoring is still an option. For example, you can 
>> see this FAQ here that touches on using 'go mod vendor' with modules:
>>
>> 
>> https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
>>
>> An alternative approach in a modules world is to use the module cache. It 
>> can end up with similar benefits as traditional vendoring (and in some ways 
>> ends up with a higher fidelity copy), but uses a different technique. This 
>> approach is explained as a "Go Modules by Example" walkthrough here:
>>
>> 
>> https://github.com/go-modules-by-example/index/blob/master/012_modvendor/README.md
>>
>> Best,
>> thepudds
>>
>> On Wednesday, December 12, 2018 at 3:52:58 PM UTC-5, snmed wrote:
>>>
>>> Thank you for you reply,
>>>
>>> yes i have already read about that project, but as far as I see, there 
>>> is no offline loading implemented.
>>> But I'm sure it would be doable with some customisation. I wondering if 
>>> there is another approach for an offline scenario.
>>>
>>> Some other ideas or suggestions?
>>>
>>> Thanks in advance
>>> Sandro
>>>
>>> Am Mittwoch, 12. Dezember 2018 21:04:07 UTC+1 schrieb Burak Serdar:

 On Wed, Dec 12, 2018 at 1:00 PM snmed  wrote: 
 > 
 > Hi all 
 > 
 > Our customer demands an offline development environment with no 
 internet connection, is there any best practices to handle package 
 download 
 and project setup for such an use case? And how would the new go modules 
 fit in in such an environment? 

 Somebody just mentioned this today. It looks like it is doing what 
 you're asking for: 

 https://github.com/gomods/athens 


 > 
 > Any advise will be most appreciated. 
 > 
 > Cheers Sandro 
 > 
 > -- 
 > 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. 
 > For more options, visit https://groups.google.com/d/optout. 

>>>

-- 
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://groups.google.com/d/optout.


[go-nuts] database/sql changes and proposals

2019-02-12 Thread Daniel Theophanes
In order to help keep database/sql driver developers and the maintainers of
database/sql on the same page, I'm going to start to posting issues and
proposals to the following group:

https://groups.google.com/forum/#!forum/golang-sql

If you are a driver developer, I would recommend subscribing to it (if you
aren't already).

Thanks, -Daniel

-- 
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://groups.google.com/d/optout.


[go-nuts] Decimal survey

2019-03-28 Thread Daniel Theophanes
Hello,

If you represent decimals or money in Go, I'd like to hear from you:
https://docs.google.com/forms/d/e/1FAIpQLScqXYCCCS4fTJXnRvB0qDWsbDXFL9tBBtwDY4y3Ym953nq5MQ/viewform

I work on database/sql and a few sql drivers. I'm hoping to make working
with decimals, especially when working with databases, much easier.

Thanks, -Daniel

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-03-31 Thread Daniel Theophanes
I don't typically run wayland anywhere, but I was interested in this 
project and installed wayland and weston from my package manager. However, 
it seems my package manager's version of weston (v4.0.0) is too old(?) 
because I get the Go error: "wayland: no xdg_wm_base available". Probably 
from 
[here](https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1051).

Do you have any tips?  Tried googling various terms, but nothing seemed 
relevant.

On Sunday, March 31, 2019 at 6:16:44 AM UTC-7, ma...@eliasnaur.com wrote:
>
> Hi,
>   
> I'm very happy to announce the first public release of Gio, a project for 
> writing portable, hardware accelerated, immediate mode GUI programs in Go.
>
> If you have Go 1.12 installed,
>
> $ export GO111MODULE=on
> $ go run gioui.org/apps/hello
>
> should display the proverbial hello world message. If not, please follow 
> the setup guide at
>
> https://gioui.org/
>
> The setup guide describes how to run the gio programs on Android an iOS. 
>
> The command
>
> $ go run gioui.org/apps/gophers
>
> runs a simple demo displaying Go contributors fetched from Github. Specify 
> a github token with the -token flag if you run out of quota.
>
> Gio programs run on all the major platforms: iOS/tvOS, Android, Linux 
> (Wayland), macOS and Windows. The project is very much experimental; don't 
> expect Gio to produce production ready programs and apps yet.
>
> Gio only depends on the platform libraries for drawing and input and 
> avoids the platform toolkits. Gio has an immediate mode design where no 
> structure is imposed on the program, not even for the layout hierachy. 
> Unlike any other Go project I know of, Gio runs on all the major platforms, 
> mobile and desktop alike: iOS/tvOS, Android, macOS, Linux, Windows.
>
> Gio includes an efficient vector renderer based on the Pathfinder project (
> https://github.com/pcwalton/pathfinder). Text and other shapes are 
> rendered without baking them into texture images, to support efficient 
> animations, transformed drawing and pixel resolution independence.
>
> I decided to release Gio a little earlier than planned because of 
> increasing activity in the Go GUI space. Fyne recently reached 1.0 and just 
> two days ago Johann Freymuth released his ui library.
> It is my ambition to make Go a natural choice for GUI programs everywhere. 
> I hope you will be inspired to help me with Gio, but if you don't, Gio is 
> dual licensed under MIT and the UNLICENSE, anyone is free to use Gio's code 
> as their own, even without attribution. The gioui.org/ui/app package is 
> particularly interesting; it abstracts window management, input and vector 
> drawing into a simple Go API. The gioui.org/cmd/gio tool packages Gio 
> programs into iOS/tvOS frameworks or Android AAR files.
>
> The wide platform support is Gio's eye-catcher, but I'm most proud of its 
> design. I've spent more than a year on the project and most of that time 
> went into designing the API. However, this early release contains very 
> little documentation (and no tests!); expect much more documentation in the 
> coming months.
>
> The project is hosted on Sourcehut (https://git.sr.ht/~eliasnaur/gio). 
> Despite its very young age, I chose Sourcehut because it is strictly open 
> source, its business model is simple and because it supports contributions 
> without registration. The mailing list (
> https://lists.sr.ht/~eliasnaur/gio-dev) is open to everyone and patches 
> are sent with git send-email. I expect that even bug reports (
> https://todo.sr.ht/~eliasnaur/gio) can be filed with an email in the 
> future.
>
>  - elias
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-04-03 Thread Daniel Theophanes
I'm running Deepin, debian based. Looking into the forums, the devs aren't 
interested in Wayland at the moment. [1] Though they are switching over the 
WM over to QT and kwin, so maybe in the future that will be an option.

I was only trying to run weston to try out gio. Thanks for the feedback, 
good to know.

1. 
https://bbs.deepin.org/forum.php?mod=viewthread&tid=133029&page=1#pid279019

On Wednesday, April 3, 2019 at 7:51:59 AM UTC-7, ma...@eliasnaur.com wrote:
>
>
>
> On Monday, April 1, 2019 at 7:18:49 AM UTC+2, Daniel Theophanes wrote:
>>
>> I don't typically run wayland anywhere, but I was interested in this 
>> project and installed wayland and weston from my package manager. However, 
>> it seems my package manager's version of weston (v4.0.0) is too old(?) 
>> because I get the Go error: "wayland: no xdg_wm_base available". Probably 
>> from [here](
>> https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1051).
>>
>> Do you have any tips?  Tried googling various terms, but nothing seemed 
>> relevant.
>>
>>
> I'm sorry I missed your question. The precursor "unstable" version of the 
> "xdg_wm_base" is "zxdg_shell_v6", which is supported by weston but not by 
> gio. However, weston is only a reference compositor and is not intended for 
> serious use. On my Fedora 29, the Gnome shell supports xdg_wm_base, but its 
> version of weston (5.0.0) does not.
>
> What distribution and version are you running? If your distribution 
> supports Wayland in general, you should be able to choose Wayland from the 
> login chooser.
>
>  - elias
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Daniel Theophanes
Hello Micha,

I'm not seeing any experiences (project building/maintaining) you are 
reporting on.

In the projects I've worked on the switch to Context has been a huge win 
all across the board. I think it would be sweet to find an effect way to 
make io.Reader take a context (I often want just that, and when I really 
need it the solution tends to be more inefficient then it could be).

Note, Context isn't just useful for servers. It is useful for any 
application. Desktop applications with GUIs, services/daemons, web 
services. In other words, if your application does an operation that could 
block (file IO, network IO, running executable) and you either have a 
halting program or a program you want to be responsive, Context is 
exceptionally useful.

As for Context.Values, I think you are dismissive of the real use-cases 
without giving proper weight to them. It can be abused. Just like 
go-routines and channels. I'm not saying we can't do better then the 
current implementation, we probably can if the benefit is seen as worth the 
cost of the change.

You're saying context is viral. It is. Just like errors are viral. Once you 
start returning them you need to propagate them back. Having a context 
argument is saying "this function, or something this function calls may 
block for undisclosed amounts of time and we need to know when to stop 
blocking and back out." There might be a better way to do ctx (and maybe 
errors) if the language was adjusted; I'm fairly sure go-routine local 
storage isn't the answer but maybe something else would be. Maybe you could 
create an Arena with a context and a pattern for returning execution on 
error and an Arena could use multiple go-routines and such. However I think 
where you would need to start is a named real experience building and 
maintaining a solution in Go that gets real use. Then look at it and see 
where it was painful and how it was so.

Lastly as an aside, github emoji reactions are fine for what they are. But 
they are not an engineering argument one way or another. Last time I 
checked no one is running a popularity contest.

Thanks, -Daniel


On Monday, August 7, 2017 at 6:40:05 AM UTC-7, Michal Strba wrote:
>
> Hi everyone!
>
> I've written a blog post called 'Context should go away for Go 2':
>
> https://faiface.github.io/post/context-should-go-away-go2/
>
> The post is about the cancelation problem in Go, how context package 
> solves it, why context package is bad anyway, and that Go 2 should do 
> something about it. Hope you enjoy reading ;)
>
> PS: I'm not sure if this post is acceptable for an experience report. If 
> you think it is / isn't, let me know.
>
> Michal Štrba
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-08 Thread Daniel Theophanes
I'm personally reasonably happy with Context as-is. Bit if you are looking
for a better solution, I completly agree with "as.utf8": the solution won't
be found in TLS/GLS (goroutine local storage) but in some other
contextual/namespace/arena type thing that is larger then a single
goroutine, is still cooperative, and can expose properties that allow
transporting it over the network as Context allows today.

On Mon, Aug 7, 2017 at 10:46 PM  wrote:

> Threads are the structural and functional loci of execution on some
> operating systems, data stored in a box accessible to each thread makes
> sense when you obey the constraint that the things in that box are to be
> used for that thread exclusively.
>
> Goroutines are different, they function like threads but have different
> structure. Structurally, they are not intended to preserve state accessible
> to the user. Goroutines are light, and I suspect that the idiom of
> goroutine local storage is incompatible to the design of the language:
> anonymous loci of flow control communicating through channels as conduits.
>
> If I could wish for an idiom taken from operating systems, TLS/GLS
> wouldn't be my first choice. I see namespaces serving a similar role on
> Plan9. The ability to share a namespace with the child or parent process.
> Namespaces include the environment and allow the caller too configure what
> resources a process has access to upon execution. Such an addition would
> also violate the unwritten rule of anonymous processes, but context is
> already doing that. The difference is that context is based on what is
> being executed (what function is called) and not where (which goroutine).
> Contexts are like function namespaces. They even have a map of arbitrary
> key-values.
>
> The exercise is to find a way to make this feel natural to the language,
> and apply such an approach to functions instead of processes, threads, or
> goroutines.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/eEDlXAVW9vU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Go tool for formatting sql in the source code

2017-09-19 Thread Daniel Theophanes
Start by building a lexer for your SQL dialect or find an existing one. Once 
done investgate the go/ast package.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Short Term DSN for database/sql

2017-11-07 Thread Daniel Theophanes
Go1.10 will ship with a driver 
connector https://tip.golang.org/pkg/database/sql/driver/#Connector . It 
would be possible for a driver to provide a callback function that returned 
the most recent authentication parameters by using that.

Thanks, -Daniel


On Tuesday, November 7, 2017 at 5:34:20 AM UTC-8, Anthony Gruetzmacher 
wrote:
>
> It appears the Generic Interface for SQL (database/sql) does not support 
> the ability to use short lived DSN's for cases like AWS's IAM 
> Authentication to RDS instances. It appears that when doing its connection 
> pooling activities it always uses whatever DSN was passed initially on Open.
>
> 1) Is this correct.
> 2) Assuming one is correct would the Golang project every consider adding 
> this feature?
> 3) If the answer is yes. How would one go about either helping to get it 
> on the road map or better yet contributing this feature back to the 
> community? What is this process?
>
> Thanks,
> Anthony Gruetzmacher
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Short Term DSN for database/sql

2017-11-09 Thread Daniel Theophanes
It allows drivers a way to provide a connection to the pool on demand,
without needing to go through a static connection string.

On Thu, Nov 9, 2017 at 9:09 AM  wrote:

> So this would allow for the driver to support a different method of
> opening the connection that the sql interface would use when it needed to
> open a new connection correct?
>
> Anthony
>
>
> On Tuesday, November 7, 2017 at 9:44:05 AM UTC-8, Daniel Theophanes wrote:
>>
>> Go1.10 will ship with a driver connector
>> https://tip.golang.org/pkg/database/sql/driver/#Connector . It would be
>> possible for a driver to provide a callback function that returned the most
>> recent authentication parameters by using that.
>>
>> Thanks, -Daniel
>>
>>
>> On Tuesday, November 7, 2017 at 5:34:20 AM UTC-8, Anthony Gruetzmacher
>> wrote:
>>>
>>> It appears the Generic Interface for SQL (database/sql) does not support
>>> the ability to use short lived DSN's for cases like AWS's IAM
>>> Authentication to RDS instances. It appears that when doing its connection
>>> pooling activities it always uses whatever DSN was passed initially on Open.
>>>
>>> 1) Is this correct.
>>> 2) Assuming one is correct would the Golang project every consider
>>> adding this feature?
>>> 3) If the answer is yes. How would one go about either helping to get it
>>> on the road map or better yet contributing this feature back to the
>>> community? What is this process?
>>>
>>> Thanks,
>>> Anthony Gruetzmacher
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/fl0GiIEmbLM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Short Term DSN for database/sql

2017-11-09 Thread Daniel Theophanes
I don't quite understand you question. It just allows drivers an alternate
way for the pool (sql.DB) to open a connection. Nothing ever is "returned".

On Thu, Nov 9, 2017 at 1:19 PM  wrote:

> What would happen if idle/closed connections that are in the SQL
> interface's connection pool? They go back to the driver provided Connector
> interface to re-authenticate/create a connection?
>
> Thanks,
> Anthony
>
>
> On Thursday, November 9, 2017 at 10:49:00 AM UTC-8, Daniel Theophanes
> wrote:
>
>> It allows drivers a way to provide a connection to the pool on demand,
>> without needing to go through a static connection string.
>>
>> On Thu, Nov 9, 2017 at 9:09 AM  wrote:
>>
> So this would allow for the driver to support a different method of
>>> opening the connection that the sql interface would use when it needed to
>>> open a new connection correct?
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, November 7, 2017 at 9:44:05 AM UTC-8, Daniel Theophanes
>>> wrote:
>>>>
>>>> Go1.10 will ship with a driver connector
>>>> https://tip.golang.org/pkg/database/sql/driver/#Connector . It would
>>>> be possible for a driver to provide a callback function that returned the
>>>> most recent authentication parameters by using that.
>>>>
>>>> Thanks, -Daniel
>>>>
>>>>
>>>> On Tuesday, November 7, 2017 at 5:34:20 AM UTC-8, Anthony Gruetzmacher
>>>> wrote:
>>>>>
>>>>> It appears the Generic Interface for SQL (database/sql) does not
>>>>> support the ability to use short lived DSN's for cases like AWS's IAM
>>>>> Authentication to RDS instances. It appears that when doing its connection
>>>>> pooling activities it always uses whatever DSN was passed initially on 
>>>>> Open.
>>>>>
>>>>> 1) Is this correct.
>>>>> 2) Assuming one is correct would the Golang project every consider
>>>>> adding this feature?
>>>>> 3) If the answer is yes. How would one go about either helping to get
>>>>> it on the road map or better yet contributing this feature back to the
>>>>> community? What is this process?
>>>>>
>>>>> Thanks,
>>>>> Anthony Gruetzmacher
>>>>>
>>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "golang-nuts" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/golang-nuts/fl0GiIEmbLM/unsubscribe.
>>>
>> To unsubscribe from this group and all its topics, send an email to
>>> golang-nuts...@googlegroups.com.
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/fl0GiIEmbLM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Is go1.10beta1 a debug or unoptimized build? (possible regression)

2017-12-22 Thread Daniel Theophanes
The beta is a normal release, not debug or no opt. File an issue, if possible 
try to get a minimal repro case you can post.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Is go1.10beta1 a debug or unoptimized build? (possible regression)

2017-12-23 Thread Daniel Theophanes
It did change. See https://golang.org/cl/76990 and 
https://github.com/golang/go/issues/20427
.

The numbers you posted look larger then anticipated if it is the same one.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: tool to print dependency graph of /vendor libs

2016-09-02 Thread Daniel Theophanes
You may be interested in github.com/kardianos/govendor
govendor list -v

On Friday, September 2, 2016 at 11:20:54 AM UTC-7, Davis Ford wrote:
>
> Hi,
>
> Does anyone know of a tool that can analyze dependencies and print a 
> graph, specifically as it relates to golang vendor'd libraries.  I'm using 
> 1.7 and most tools don't seem to be able to produce results on a project 
> that is using vendor'd dependencies.
>
> Tools I've tried: 
>
>- https://github.com/shurcooL/cmd/tree/master/goimporters
>- https://github.com/shurcooL/cmd/tree/master/goimportgraph
>
> It generates a nice svg graph for my src/ but isn't including the source 
> w/in the src/vendor directory
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Govendor and Docker Build Container issues

2016-09-20 Thread Daniel Theophanes
I would run
govendor list
Does it report any external packages? If so run "govendor add +external"

On Tuesday, September 20, 2016 at 8:12:16 AM UTC-7, sc28 wrote:
>
> I have a application structure as follows in my GoPath:
>
> --/ myproject
> |
> |-- apps
>|-- app1
>  |-- main.go
>|-- app2
>  |-- main.go
>|-- appN
>  |-- main.go
> |-- libs
>   |-- myCommonPackage
>|-- gofile1.go
>|-- gofile2.go
>
>
> If I go into each "app" and execute the following:
>
>>govendor init
>>govendor add +external +local
>
> I get the external (github) packages and my local (libs/myCommonPackage) 
> vendored int he /vendor folder and everything builds fine locally.
>
>
> Now I'm trying to use docker to build the apps, using the following 
> command:
>
>  docker run --rm -it  -v "$PWD":/usr/src/app -w /usr/src/app 
> golang:1.7 go get (the container's GOPATH is at /go/app)
>
>
> The goal here is to allow my DevOps guy to pull the source and build the 
> executable inside a docker container (containing GOlang). 
>
> The build inside the 'build' container fails on my local package (all the 
> vendored github/golang.org) are found, but it errors on the 
> /libs/myCommonPackage saying it cannot be found.
>
>
> What is a better structure that would allow me to use 'local' packages 
> that are vendored, but that could be found by the docker build container?
>
>
>
>
>
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] golang and java, a view

2016-10-24 Thread Daniel Theophanes
Go1.8 will support multiple result sets if the driver support it.

There are people who would like to get a  decimal package, there is a proposal, 
but there is a lack of time on that.

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] golang and java, a view

2016-10-24 Thread Daniel Theophanes
Oracle and ms SQL server support multiple active row sets (MARS). I've also
used a table buffer in Go and C#. You can buffer results today in go

On Mon, Oct 24, 2016, 10:24 Pietro Gagliardi  wrote:

>
> On Oct 24, 2016, at 12:24 PM, Daniel Theophanes 
> wrote:
>
> Go1.8 will support multiple result sets if the driver support it.
>
>
> I believe they meant being able to have multiple result sets usable at a
> time, which implies ditching the stream-based model for the more widely
> adopted "slurp it all into memory and make it available as a random-access
> array" model. Your call as to whether it's a good thing.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2016-10-24 Thread Daniel Theophanes
My understanding is that the original rust font render code could replace 
something like FreeType. Do you envision using iconvg and vector as a 
replacement for the go freetype package, where font glyphs would be loaded 
in as iconvg byte streams in a cache and then simply read from there in the 
render loop, resulting in little to no additional allocations or re-parsing 
of the original font glyph?

On Sunday, October 23, 2016 at 11:52:48 PM UTC-7, Nigel Tao wrote:
>
> I was looking for a compact, binary format for simple vector graphics. 
> I didn't find one that did all I wanted. 
>
> SVG is the de facto standard for vector graphics, in the open source 
> world. Unfortunately, https://www.w3.org/TR/SVG/single-page.html 
> prints as 400 pages, not including the XML, CSS or XSLT 
> specifications. The S in SVG doesn't stand for simple. 
>
> The Haiku Vector Icon Format is pretty close. Unfortunately, I didn't 
> find a written specification, only a single C implementation, tightly 
> coupled, as far as I could tell, to the Haiku operating system. Also, 
>
> https://www.haiku-os.org/articles/2009-09-14_why_haiku_vector_icons_are_so_small
>  
> says that "you wouldn't really want to use HVIF to store generic 
> vector graphics". 
>
> OpenType fonts contain vector graphics (glyphs), and people use it for 
> icon and emoji fonts. Unfortunately, there doesn't appear to be a 
> clear standard for colored or partially transparent glyphs. 
> https://en.wikipedia.org/wiki/OpenType#Color lists three competing 
> approaches, built on PNG, SVG or neither. 
>
> So, as an experiment, I invented a new format: IconVG. The format 
> itself is documented at 
> https://godoc.org/golang.org/x/exp/shiny/iconvg and there are some 
> examples at https://go.googlesource.com/exp/+/master/shiny/iconvg/testdata 
>
> The Material Design icon set (https://design.google.com/icons/) 
> consists of 961 vector icons. As SVG files, this totals 312,887 bytes. 
> As 24*24 pixel PNGs, 190,840 bytes. As 48*48 pixel PNGs, 318,219 
> bytes. As IconVGs, 122,012 bytes. 
>
> Like all of the golang.org/x/exp/shiny code, this is experimental, but 
> I think that IconVG is at an interesting enough point now to share. 
>
> The vector rasterizer at golang.org/x/image/vector is also a nice Go 
> package, in my biased opinion, based on the algorithm described at 
>
> https://medium.com/@raphlinus/inside-the-fastest-font-renderer-in-the-world-75ae5270c445#.ja3y3m6z2,
>  
>
> but that's probably a different topic for a different time. 
>
> Comments welcome. 
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Suggestion: port golang.org/x/mobile/exp/audio/al to Windows

2016-10-28 Thread Daniel Theophanes
I would love to also see this happen. If you have time feel free to 
document your approach you took and what your success was, or submit a 
change request yourself. -Daniel

On Thursday, October 27, 2016 at 10:22:50 AM UTC-7, faifa...@gmail.com 
wrote:
>
> Hi there,
>
> recently I posted a question in this group asking why 
> golang.org/x/mobile/exp/audio/al doesn't support Windows. I've got one 
> answer, saying something like: "it belongs to golang.org/x/mobile, so 
> that's why".
> However, *there is no single satisfying multiplatform audio library for 
> Go*, out there!
>
> Since golang.org/x/mobile/exp/audio/al looks quite solid + OpenAL is 
> really multiplatform, *I strongly suggest someone ports it to Windows*. 
> It already supports Mac OS X and Linux, so why not.
>
> It could potentially be also moved to a different address after, because a 
> completely multiplatform (Windows, Mac, Linux, Android, ...)  audio library 
> doesn't really belong to a mobile suite.
>
>
> *Porting this library to Windows would really shift multimedia development 
> in Go forward.*
> Thanks
> Michal Štrba
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Daniel Theophanes
If you open DB with db.Open, yes, you will need to call db.Close(). Without 
that it will keep alive a pool of connections to your remote database. 
-Daniel

On Monday, October 31, 2016 at 10:33:06 PM UTC-7, Francis Chuang wrote:
>
> I want to use Vault  to manage and 
> rotate the usernames and passwords to my databases.
>
> If I open a connection: db, err := sql.Open("mysql", ""), and then 
> later on, open a new connection due to the username/password being rotated: 
> db, err = sql.Open("mysql", "...") //no new variables created,
> will the original sql instance leak? I want to avoid having to force all 
> current queries and executions on the old db to terminate using Close(), as 
> I would need to have some mutex to act as a gatekeeper for all interactions 
> with the database, which would be quite complex.
>
> Ideally, I would prefer the following:
> 1. New username/password pair received and sql.Open() is called.
> 2. Old db instance is still being used by a few goroutines as they still 
> hold references to the old sql instance.
> 3. Goroutines finishes and no longer hold references to the old sql 
> instance. The old sql instance is GC'd. Is this possible without calling 
> Close()?
> 4. New goroutines are launched and they use the new sql instance.
>
> Cheers,
> Francis
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Daniel Theophanes
I think there is a larger issue at play of how old connections are cached and 
handled. In particular there is no way to flush cached connections or update 
credentials in the API.

Could you file an issue with how to best update credentials on an existing 
connection pool?

-- 
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://groups.google.com/d/optout.


[go-nuts] How can I make io.Reader stop reading?

2016-11-16 Thread Daniel Theophanes
You can also use it.CopyContext and cancel the ctx. 

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-09 Thread Daniel Theophanes
Hi Chandra,

In my view using context to store value for these uses (Read-Only and 
Isolation Level) is somewhat of a gray area. They are not a classical 
request only scope, like a tracing ID, but they also aren't strictly 
limited to a single request either. Say you wanted to kick off a request, 
but ensure you don't modify the database in anyway. you could pass in a 
context with ReadOnly set and any further request function will follow that 
directive. Similarly, by allowing you to set the Isolation at a higher 
level, you can effectively influence the behavior of the queries for any 
subsequent request action.

Should we do it this way? Maybe, maybe not. I think there are benefits to 
this approach, and I think they can be considered request scoped, even if 
in the degenerate case they are set at the query level. However, I think it 
will be really common to set these when dispatching requests in the router 
and using them for the subsequent requests.

Has /report/ prefix? Set to ReadOnly and Isolation X
Has /api/ prefix? Set Isolation to Y

At least that is how I would envision using them. I have been known to be 
wrong before.
What do you think? -Daniel


On Thursday, December 8, 2016 at 11:27:36 PM UTC-8, Chandra Sekar S wrote:
>
> Bump
>
> --
> Chandra Sekar.S
>
> On Wed, Dec 7, 2016 at 10:24 AM, Chandru 
> > wrote:
>
>> I can understand db/sql using Context for cancellation. It is the 
>> optional arguments to BeginContext like IsolationLevel and read-only flag, 
>> which are not request-specific, that seem to contradict context's 
>> documentation.
>>
>> --
>> Chandra Sekar.S
>>
>> On Tue, Dec 6, 2016 at 9:50 PM, > 
>> wrote:
>>
>>> Either the doc should be changed or the std lib should follow the spirit 
>>> of the doc. But my understanding is that context.Context is not just about 
>>> HTTP request/response cycle but deals with anything that needs cancellation 
>>> or a resource clean up signal , some kind of DIY RAII . In any case the 
>>> documentation should be clarified. 
>>>
>>> Le mardi 6 décembre 2016 16:48:48 UTC+1, Chandra Sekar S a écrit :

 Documentation of the context package says,

 "Use context Values only for request-scoped data that transits 
 processes and APIs, not for passing optional parameters to functions."

 sql.BeginContext introduced in 1.8, uses Context to receive options 
 like IsolationLevel and read-only flag. These are neither request-specific 
 nor cross-cutting. They are options that are typically specific to a type 
 of operation, but common to all requests.

 Isn't this use in db/sql contradicting the recommendation in context's 
 doc?

 --
 Chandra Sekar.S

>>> -- 
>>> 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 .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-10 Thread Daniel Theophanes

André,

Thanks for the constructive feedback. I agree the signature you propose would 
be another way to do this.

For people who care about these settings, I would expect multiple queries per 
request is normal and ensuring the props are the same sounds like a benefit, 
not a detriment. In other words, I think you may be underestimating how tied 
these are to a request.

As another way of framing this, what do people have in their context Value 
whitelist?

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-11 Thread Daniel Theophanes
How would you put them in query when args are the last ...warm?

On Sat, Dec 10, 2016, 22:44 Tamás Gulácsi  wrote:

> I'd also like to change the API for passing options as Andrè suggested: by
> optional funcs. But everywhere - they're not to be in a Context!
>
> To put them in Context feels a hack.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/20NtIGTgBeg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-11 Thread Daniel Theophanes
I don't think ops in context is how I would clean room design this, but it
is the better of many other options.

The tx begin is easier, but still difficult when I need to ensure drivers
can set custom attributes. The problem with something like you suggested is
it deviates too far from the original API.

If you have a concrete proposal, file an issue cc me in the next day or
two. At the least tx begin needs a way for drivers to set custom
attributes.

On Sun, Dec 11, 2016, 06:48 Gulácsi Tamás  wrote:

> Good question.
> QueryContext(ctx context.Context, query QueryWithOpts, args
> ...interface{}) (sql.Rows, error)
> ?
>
> Where
> type QueryWithOpts struct {
> fmt.Stringer
> opts []qryOpt
> }
>
> and
>
> func Query(qry string, options ...qryOpt) QueryWithOpts
>
> á'lá sql.NamedArg.
>
>
> But this feels just as hacky, as putting those options into the context...
>
> Daniel Theophanes  ezt írta (időpont: 2016. dec.
> 11., V, 14:48):
>
> How would you put them in query when args are the last ...warm?
>
> On Sat, Dec 10, 2016, 22:44 Tamás Gulácsi  wrote:
>
> I'd also like to change the API for passing options as Andrè suggested: by
> optional funcs. But everywhere - they're not to be in a Context!
>
> To put them in Context feels a hack.
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/20NtIGTgBeg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Daniel Theophanes
Jacek,

This is a known usecase, one which other companies also operate under. 
Right now the tooling isn't great. However this is known and I hope that 
this will be better addressed in the next 6 months. A number of people will 
be focusing on dependency management this year.  Some projects allow 
setting origin separately from import path (govendor allows this).

Thanks, -Daniel


On Friday, January 6, 2017 at 8:35:41 AM UTC-8, Jacek Furmankiewicz wrote:
>
> Hi everyone,
>
> We are operating in a SOC2 environment, which our customers demanded as we 
> host their systems and their data.
> It's a common requirement for many companies in a cloud environment.
>
> One of the key requirements of SOC2 is that *all* external 
> libraries/depdencies are mirrored internally and 
> *NOT*fetched directly from public Internet during the code building 
> process.
>
> With our Java apps, this is simple. We have an internal Artifactory 
> instance and we mirror all the Java libraries from the Maven Central 
> repository there
> (after each and every one of them goes through legal license review, to 
> exclude GPL, etc).
>
> All of our build servers are locked down and cannot reach public Internet, 
> only our local library mirror.
> All of our Gradle build scripts are locked down to allow fetching 
> dependencies from our local Maven mirror only.
>
> As you can imagine, this is anathema to how entire dependency management 
> works in Go (and all the related tools, like go get, etc).
>
> Even if we mirrored Go git repos for the libraries we want in our internal 
> Stash repository,
> pretty much all the current Go build tools (e,g. Glide) would still go to 
> the public internet to look for dependencies of any library.
>
> e.g.:
>
> https://github.com/Masterminds/glide/issues/729
>
>
> Just wanted to hear if there are any Go shops out there that operate in a 
> SOC2 environment and what combination of tools / procedures do you use.
>
> We are very interested in Go adoption for some of our real-time 
> server-side applications, but the way dependency management works in Go
> is a total showstopper due to the stringent security requirements of SOC2.
>
> I would greatly appreciate any input, comments, suggestions from the Go 
> community.
>
> Much appreciated
> Jacek
>

-- 
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://groups.google.com/d/optout.


[go-nuts] database/sql: special interest group

2017-01-08 Thread Daniel Theophanes
In go1.8 I worked on adding a number of features to "database/sql". I hope
to address a few more needs in the go1.9 cycle. To that end I want to
gather some other voices who both use Go and who use SQL based database
servers regularly. Even if you don't use "database/sql" I would still like
to hear from you.

I've created a new group https://groups.google.com/forum/#!forum/golang-sql for
such discussion and interest. I would like to discuss a few of the issues
listed at https://github.com/golang/go/issues/assigned/kardianos with a
wider audience instead of the one or two people who happened upon the issue
at hand.

In the further future I would like to discuss connection pool and driver
optimizations, testing, and a dedicated (non-std lib) package for defining
SQL types, common utilities such as table buffers, and interfaces like bulk
load. I think it would also be good to vet drivers through a common testing
suit and setup CI for drivers without it yet.

Thanks, -Daniel

-- 
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://groups.google.com/d/optout.


[go-nuts] State of the database drivers in go

2017-01-12 Thread Daniel Theophanes
I know drivers for postgesql, MySQL, Ms SQL server, and Oracle are maintained.

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: State of the database drivers in go

2017-01-13 Thread Daniel Theophanes
If you are using database/sql in a fresh project, I highly recommend 
starting on go1.8 (the first release candidate is out now). Also, if you 
encounter fundamental blocking issues with the database/sql package, please 
send a message to: https://groups.google.com/forum/#!forum/golang-sql

Thanks, -Daniel


On Friday, January 13, 2017 at 4:27:06 AM UTC-8, snmed wrote:
>
> Thats great to hear, i will start a prototype of the project with postgres 
> and mongodb. Then i will see if our needs are satisfied and
> if we stay with go. :-) I really hope it is working out for us, i would 
> prefer to use go now and in the future:-D
>
> Cheers
>
> Am Donnerstag, 12. Januar 2017 16:42:52 UTC+1 schrieb Josh Kamau:
>>
>> I have an app in production using Postgres. The library has never been a 
>> problem.  I have read good reviews for mgo but i have not used it personally
>>
>> Josh
>>
>>
>>
>> On Thu, Jan 12, 2017 at 6:39 PM, Henrik Johansson  
>> wrote:
>>
>>> Mgo https://labix.org/mgo seems to be very well maintained.
>>>
>>> tors 12 jan. 2017 kl 16:26 skrev snmed :
>>>
>>>> Thank you for your answer, so far i think at least for the rdbms there 
>>>> are maintained drivers. So i need just a reliable NoSql Driver for a 
>>>> Document-Based Storage.
>>>> Go is awesome i hope the eco system will grow in the future and the 
>>>> language can stand against rust and the omni present of c/c++.
>>>>
>>>> Cheers snmed
>>>>
>>>>
>>>>
>>>> Am Donnerstag, 12. Januar 2017 16:18:17 UTC+1 schrieb Daniel Theophanes:
>>>>>
>>>>> I know drivers for postgesql, MySQL, Ms SQL server, and Oracle are 
>>>>> maintained.
>>>>
>>>> -- 
>>>> 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.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] UniDoc PDF Toolkit for golang

2016-07-16 Thread Daniel Theophanes
I would recommend you clarify your public / commercial licensing and make 
it more prominent in advertising and home page.

I would also note that AGPL is probably unusable in most Go programs 
(statically linked and all). -Daniel

On Saturday, July 16, 2016 at 8:22:00 AM UTC-7, ah...@owlglobal.io wrote:
>
> Hi all.
>
> Today we are releasing UniDoc version 1.0, a comprehensive open source PDF 
> toolkit written in Go. Please see our release post 
> http://unidoc.io/news/launching-unidoc.
>
> We have big plans for this library documented on our website.
>
> The current feature set is:
>  - Merge PDF
>  - Split PDF
>  - Protect PDF
>  - Unlock PDF
>
> This is used for the majority of document processed at 
> https://foxyutils.com.
>
> Website: http://unidoc.io
> GitHub: http://github.com/unidoc/unidoc
> Email: sup...@unidoc.io 
>
> Appreciate any feedback, comments, suggestions
>
> Enjoy.
> Alf
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: nodemon style tool

2016-07-25 Thread Daniel Theophanes
If you are looking for a file watch tool where you can do those things, you 
could look at modd:
https://github.com/cortesi/modd#quick-start

On Monday, July 25, 2016 at 10:36:18 AM UTC-7, KLR wrote:
>
> Hi, is there a nodemon style tool for go (or less bulky) or has anyone a 
> recommendation for server restart after code changes bash script for that 
> and watching several files .go and polymer (.html)? Thanks, Karl
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: How do i create a fake drive that shows up in windows explorer?

2016-07-29 Thread Daniel Theophanes
If you're on windows you either want https://dokan-dev.github.io/ which 
shows up as a native drive or 
webdav https://godoc.org/golang.org/x/net/webdav which shows up as a 
network drive.

On Thursday, July 28, 2016 at 4:31:22 PM UTC-7, Justin C wrote:
>
> Good afternoon,
> I am trying to create a fake (virtual?) drive that would display a 
> programmatic generated file system tree that when the user clicks on a file 
> in internet explore it opens the file but could first run operations on 
> that file like log that it was opened or even de-crypt the file and then 
> return it to the user. (Boxcryptor classic does it some how if anyone knows 
> how that works.)
> Is this possible with Go? Would this be only possible written in c++? 
> I have bin looking at github.com/blang/vfs  
> When looking at it I'm wondering if this only creates the file system for 
> that go program or does it also show up in Windows explorer? Would it 
> showing up in internet explorer be a step in it's self?
> Sorry for such a open ended question but I'm struggling to understand what 
> i should be looking into. Do i need to be looking into a virtual file 
> system or is it called something else? 
> Any help would be greatly appreciated!
>
>  
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: How to check that a Go package has not been modified?

2016-08-03 Thread Daniel Theophanes
What is the purpose of this? For instance, In govendor the hash of the 
files, file names, and path is computed and recorded. That way if they are 
modified it is detected. So yeah, md5 or blake2 would work just fine.

On Wednesday, August 3, 2016 at 10:14:53 AM UTC-7, atd...@gmail.com wrote:
>
> Would a md5 hash suffice?
>
> I mean, it is probably easy to create collisions, but the source still 
> needs to compile so...
>
> Or an md5 hash and using go/types to make sure that any object escaping 
> the package boundaries is still present and none other have been added.
>
> Any idea?
>
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Panic in go1.8rc3 using cgo to get binary data from database

2017-02-12 Thread Daniel Theophanes
It is difficult to be certain, but I would put my bets on your sql anywhere 
driver may not be handling the c data lifetimes correctly, or might not be 
keeping a reference. It is difficult to tell without the driver code.

Thanks, -Daniel

On Saturday, February 11, 2017 at 7:27:11 PM UTC-8, Mark Crook wrote:
>
> Hello,
>
> I'm seeing a panic in go version go1.8rc3 linux/amd64 while trying to 
> write a database driver using cgo. The go code runs in a docker container, 
> the database in another.
>
> Generally it works reliably, but occasionally, during repeated retrieval 
> of binary data (photos approx 100K to 2M), the code panics.
>
> I haven't isolated a reproducible example, but I think it's related to 
> this code:
>
>
> value := new(C.a_sqlany_data_value)
>
> //load the column value binary data into value.buffer
>
> C.sqlany_get_column(r.stmt.ptr, C.sacapi_u32(i), value)
>
>
> //copy the value buffer from C to Go
>
> val = C.GoBytes(unsafe.Pointer(value.buffer), C.int(value.length))
>
>
> I haven't seen the panic if the last line is commented out.
>
> Below is a stack trace. Perhaps it panics when a garbage collection is 
> triggered while waiting for C.GoBytes to return?
>
> Any suggestions?
>
> Thank you,
> Mark
>
>  
>
> runtime: unexpected return pc for runtime.sigpanic called from 0xc420e1a000
> fatal error: unknown caller pc
>
> runtime stack:
> runtime.throw(0x59a90e, 0x11)
> /go/src/runtime/panic.go:596 +0x95
> runtime.gentraceback(0x, 0xc42002a5d8, 0x0, 0xc4200c49c0, 
> 0x0, 0x0, 0x7fff, 0x7fb675ad5cb8, 0x0, 0x0, ...)
> /go/src/runtime/traceback.go:317 +0x13ea
> runtime.scanstack(0xc4200c49c0, 0xc420021828)
> /go/src/runtime/mgcmark.go:842 +0x265
> runtime.newstack(0x0)
> /go/src/runtime/stack.go:1064 +0x41e
> runtime.morestack()
> /go/src/runtime/asm_amd64.s:398 +0x86
>
> goroutine 11 [GC worker (idle) (scan)]:
> runtime.assertE2I2(0x56c220, 0x569e20, 0x841d20, 0xc42002a6b0, 
> 0xc4200c49e0, 0xc42002a640)
> /go/src/runtime/iface.go:289 +0xb2 fp=0xc42002a5e0 sp=0xc42002a5d8
> runtime.preprintpanics(0xc42002a6b0)
> /go/src/runtime/panic.go:389 +0x9f fp=0xc42002a650 sp=0xc42002a5e0
> panic(0x569e20, 0x841d20)
> /go/src/runtime/panic.go:528 +0x1ab fp=0xc42002a6e8 sp=0xc42002a650
> runtime.panicmem()
> /go/src/runtime/panic.go:63 +0x5e fp=0xc42002a708 sp=0xc42002a6e8
> runtime.sigpanic()
> /go/src/runtime/signal_unix.go:290 +0x29f fp=0xc42002a758 sp=0xc42002a708
> created by runtime.gcBgMarkStartWorkers
> /go/src/runtime/mgc.go:1410 +0x98
>
> goroutine 1 [chan receive]:
> testing.(*T).Run(0xc420072820, 0x598622, 0x8, 0x5a3718, 0xc420051d01)
> /go/src/testing/testing.go:698 +0x2f4
> testing.runTests.func1(0xc420072820)
> /go/src/testing/testing.go:881 +0x67
> testing.tRunner(0xc420072820, 0xc420051de0)
> /go/src/testing/testing.go:657 +0x96
> testing.runTests(0xc42000cb60, 0x8461e0, 0x4, 0x4, 0xc420051ef8)
> /go/src/testing/testing.go:887 +0x2c1
> testing.(*M).Run(0xc420051f20, 0xc420051f20)
> /go/src/testing/testing.go:822 +0xfc
> main.main()
> github.com/mdcnz/sqlanywhere/_test/_testmain.go:48 +0xf7
>
> goroutine 17 [syscall, 6 minutes, locked to thread]:
> runtime.goexit()
> /go/src/runtime/asm_amd64.s:2197 +0x1
>
> goroutine 231 [GC assist wait]:
> database/sql.convertAssign(0x5517a0, 0xc4200c20a0, 0x55a040, 0xc42000c0e0, 
> 0x85b5c0, 0x4535c0)
> /go/src/database/sql/convert.go:161 +0x1a22
> database/sql.(*Rows).Scan(0xc42001c6c0, 0xc420041f68, 0x1, 0x1, 0x0, 0x0)
> /go/src/database/sql/sql.go:2342 +0xca
> github.com/mdcnz/sqlanywhere.TestBlob(0xc4200728f0)
> /root/gome/src/github.com/mdcnz/sqlanywhere/test.go:26 +0x2a5
> testing.tRunner(0xc4200728f0, 0x5a3718)
> /go/src/testing/testing.go:657 +0x96
> created by testing.(*T).Run
> /go/src/testing/testing.go:697 +0x2ca
>
> goroutine 233 [chan receive]:
> database/sql.(*Rows).awaitDone(0xc42001c6c0, 0x84b240, 0xc42047e080)
> /go/src/database/sql/sql.go:2091 +0x54
> created by database/sql.(*Rows).initContextClose
> /go/src/database/sql/sql.go:2086 +0x92
>
> goroutine 232 [chan receive]:
> database/sql.(*DB).connectionOpener(0xc42008c210)
> /go/src/database/sql/sql.go:835 +0x4a
> created by database/sql.Open
> /go/src/database/sql/sql.go:580 +0x1c8
> exit status 2
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] is this race condition normal?

2017-02-18 Thread Daniel Theophanes
All detected race conditions are a problem. Use a mutex.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] fsq 1.4.0 released

2017-03-11 Thread Daniel Theophanes
That's cool!

I would suggest however that you also checking y.go, as is conventional in 
go. That way "go get" works out of box, and is one less step to install.

Thanks for the tool, every once in a while I want something like this. 
-Daniel


On Saturday, March 11, 2017 at 12:22:26 PM UTC-8, Rob Upcraft wrote:
>
> Hi,
>
> I've been working on this project for about a year now, so I figured I'd 
> finally post something on this list...
>
> fsq is a BSD-licensed command line tool for querying the file system.  It 
> aims to use efficient I/O when possible, but most of all, strives to to 
> make it easy to write readable file system search queries.  The project 
> started life as a way for me to play around with Go's built-in version of 
> yacc, but has since become a useful tool for doing file system searches 
> (particularly for generating reports about the contents of large code 
> repositories).
>
> The source code, documentation, and links to pre-built binaries for a 
> number of platforms can be found, here:
> https://github.com/upcrob/fsq
>
> Happy searching!
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: sql: please, guys, tell me I am doing it wrong.

2017-04-03 Thread Daniel Theophanes
You're doing it wrong.

You want: https://godoc.org/bitbucket.org/kardianos/table

On Monday, April 3, 2017 at 5:51:04 AM UTC-7, JuciÊ Andrade wrote:
>
> I built a little command line utility for running arbitrary sql queries. 
> You use it like:
>
> runQuery "select * from myTable"
>
>
> Previously I have build similar tools in C and Java and I don't remember 
> needing to code a hack to handle a variable number of columns.
>
> https://play.golang.org/p/6WOu1SzgcZ
>
> Am I missing something here? How can I iterate inside each record, 
> converting values to strings?
>
>
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Go MySql - out parameter

2017-04-04 Thread Daniel Theophanes
mssql driver ( https://github.com/denisenkom/go-mssqldb ) doesn't yet
support output variables, though I have support planned for go1.9. You can
use rdb (I currently use it in a line of business application), but I would
recommend you use https://github.com/denisenkom/go-mssqldb if possible
(select your output vars in SQL text if that is an option) as that will
supersede rdb/ms and database/sql will supersede rdb.

On Tue, Apr 4, 2017 at 5:27 AM  wrote:

> Hi Kiril,
>
> Were you able to get this working , I am also struggling to get the Output
> parameters working with mssql driver .
>
> @Daniel - can i use this http://godoc.org/bitbucket.org/kardianos/rdb
>
>
>
> Thanks,
> Dharam
>
> On Wednesday, May 7, 2014 at 2:29:48 PM UTC+1, Kiril wrote:
>
> Hi guys,
> Does anyone know how to execute mysql stored procedure with output
> parameters?
>
> I use github.com/go-sql-driver/mysql
>
>
> email:= v.Get("email")
>
> pss:= v.Get("pss")
>
>
> var userId string
>
> var errorCode int
>
>
> // Execute the query
>
> rows, err := db.Query("CALL User_Register(?,?,?,?)", email,pss,errorCode, 
> userId)
>
> if err != nil {
>
>  panic(err.Error())
>
> }
>
>
> I do know how to pass regular params and how to get the  field's value from 
> select in one row\rows
>
>
>
> in my case, errorCode and userId will be output.
>
>
>
> thanks in advance
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/5AJyGW9d9Wg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Last Gasp Call for Native Decimal Support

2017-04-05 Thread Daniel Theophanes
Indeed, those tests are used within apd
https://github.com/cockroachdb/apd/tree/master/testdata

On Wed, Apr 5, 2017 at 5:02 PM Michael Jones 
wrote:

> In one of the many threads about this (five years ago!) I mentioned Mike
> Colinshaw's excellent work:
>
> http://speleotrove.com/decimal/
>
> This is an excellent and correct library. I can be inspiration for a
> native Go implementation.
>
> On Wed, Apr 5, 2017 at 4:51 PM, Mandolyte  wrote:
>
> Doesn't help with operators, but noticed this:
> https://www.cockroachlabs.com/blog/apd-arbitrary-precision-decimal-package/
>
>
> On Wednesday, March 29, 2017 at 1:27:22 PM UTC-4, a.mat...@ra-micro.de
> wrote:
>
>
> No!
>
>
> We want to use operators like + , - , *  and /  with decimal values. This
> is actualy a "No Go" !
>
> --
> 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://groups.google.com/d/optout.
>
>
>
>
> --
> Michael T. Jones
> michael.jo...@gmail.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/YczDW-4QMtE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [database/sql] Why do DB.QueryContext and Stmt.QueryContext have different retry logic?

2017-05-19 Thread Daniel Theophanes
I think this is a bug. Please file an issue. The go1.9 freeze is already in 
place, but this may qualify as a bugfix that will fly under that if done 
quickly.
Thanks, -Daniel


On Friday, May 19, 2017 at 7:52:42 AM UTC-7, Krzysztof Drys wrote:
>
> We are getting problems with driver.ErrBadConn, but only if we use the 
> prepared statements. It seems to me that this is because DB.QueryContext 
> retries with a fresh connection and Stmt.QueryContext does not. I want to 
> verify whether this is a bug or an expected behaviour, 
>
> When DB.QueryContext receives driver.ErrBaddConn from the driver it will 
> retry twice (maxBadConnRetries) using cached connection (cachedOrNewConn 
> strategy). If this fails, it will retry once more using new connection 
> (alwaysNewConn strategy). The code is here: 
> https://golang.org/src/database/sql/sql.go?s=7997:9207#L1223
>
> Stmt.QueryContext will also retry twice (again maxBadConnRetries) using 
> the cached connection. If this fails, it will return driver.ErrBadConn, 
> without retrying using the new connection. The code is here: 
> https://golang.org/src/database/sql/sql.go?s=7997:9207#L1935 s.connStmt 
> uses cachedOrNewConn strategy.
>
> I think this is a bug (but I will be happy to hear otherwise), introduced 
> in this commit: 
> https://github.com/golang/go/commit/c468f94672af25bc34975ba96309e20e972fa340
>
> Before this commit, maxBadConnRetries was 10 and retries where alway done 
> using old (cached) connections. Commit changed the logic, decreasing the 
> number of retires and adding one more retry on fresh connection. While 
> decrease was global (both *DB and*Stmt), retry-using-fresh-connection logic 
> was applied only to *DB. 
>
> So is it a bug (aka something I can report on 
> https://github.com/golang/go/issues) or is it an expected behaviour?
>
> Thanks,
> Krzysztof Dryś
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: DB not releasing connections during performance tests

2017-05-29 Thread Daniel Theophanes
If you can provide a running example that demonstrates how the database/sql 
package + driver opens more connections then db.SetMaxOpenConns specify, 
then it can be considered a bug and should be reported to 
https://golang.org/issue .

On Thursday, May 25, 2017 at 7:25:48 AM UTC-7, viridi...@gmail.com wrote:
>
> Hi All,
>
> I'm using go-sql-driver/mysql in my web-application. Each API call has 
> about 3-4 queries it performs. Which are all insert or fetch single row 
> queries like:
>
> _, err := db.Exec(query, parms)
>
> if err != nil {
> log.Fatal(err)
> 
> }
>
> err := db.QueryRow(query, params).Scan(&data)
> if err != nil {
> log.Fatal(err)
> 
> }
>
> I have also the following configuration
> db.SetMaxOpenConns(50)
> db.SetMaxIdleConns(20)
>
> I am making a call to 2 api's which have a combined db call of 8 queires. 
>  When I make a call with 120 concurrent users with a ramp up time of 5 sec 
> i get Error 1040: Too many connections.
>
> it works fine for up to 90-100 users. My question is why does the db not 
> re-using the connections or why does it not release the connections soon 
> enough?
>
> As both Exec and QueryRow are supposed to release connections immediately 
> since I use Scan soon after, shouldn't the number of connections it support 
> be more in number than just double?
>
> Any insight is appreciated.
>
>
>
>
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Using Context to store TraceIDs

2017-05-31 Thread Daniel Theophanes
Hi Bill,

Generally if you have a Trace ID, you are also doing something that 
involves multiple systems, processes, or routines. If that is the case, you 
also need a way to cancel your resource. Thus Trace ID is included with 
values in the context and not separated.

When Dave voiced his own preference to separate out Value from Cancelation, 
the response was, "it was considered, but the benefit and complication was 
deemed to not be worth it".

I understand what you are saying about hidden values and all, and how those 
aren't explicit. But I guess I don't personally care. This "not caring" can 
pay off where different applications have different per-request parameter 
needs, but want to leverage the same API for framework needs. 

That's my own 2 cents anyway. -Daniel

On Tuesday, May 30, 2017 at 8:39:18 AM UTC-7, William Kennedy wrote:
>
> After reading this:
>
> https://cloudplatform.googleblog.com/2017/04/distributed-tracing-for-Go.html
>
> I can see how the Context is being used, through a separate API. Would it 
> make sense to use a separate Context value for the "Trace" Context and use 
> a separate Context value for the  "Cancellation" Context in the application 
> independent package API's?
>
> I am just starting to think about these things from an API and readability 
> point of view. Just curious what others think.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Completeness of Golang drivers for open-source and enterprise databases.

2017-06-10 Thread Daniel Theophanes
I didn't know of anyone working on those drivers.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Daniel Theophanes
I don't think this has anything to do with the Context method variants or 
Context related code.

This is just two different checks. One when the connection is returned, one 
periodically. You seemed to say this was introducing latency. Can you make 
some benchmarks with a real driver, one with the normal code and one with 
the sync check commented out?

Thanks, -Daniel

-- 
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://groups.google.com/d/optout.


[go-nuts] First column in sql rows.Scan is always zero

2020-06-10 Thread Daniel Theophanes
Can you try to use

github.com/golang-sql/table

? That might help.

-- 
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/07fab98e-c217-4fbc-82c4-686de2ab30b9o%40googlegroups.com.


Re: [go-nuts] Data race in sql package

2022-07-26 Thread Daniel Theophanes
It should be safe to use RawBytes from *Conn or *Tx, the transaction won't 
be re-used. We will look into it further.

On Friday, July 22, 2022 at 4:40:16 AM UTC-5 Michal Hruby wrote:

> That's right, atm there's no safe way to use sql.RawBytes, it should 
> either be documented that you need to manually control the context, or the 
> standard library shouldn't be closing the driver.Rows unless the user calls 
> Scan or Close.
>
> On Fri, 22 Jul 2022, 00:45 Steven Hartland,  
> wrote:
>
>> I'm guessing that Michal is flagging is there no way to write safe code 
>> if your using stmt.QueryContext(ctx) and rows.Scan into a sql.RawBytes 
>> as QueryContext kicks off a go routine that monitors the ctx, closing rows 
>> if cancelled and that ctx can be cancelled at any time.
>>
>> The only thing that springs to mind is to only allow the cancellation 
>> processing to happen while in sql functions which would mean that 
>> sql.RawBytes can't be updated while the consumer, user code, is processing 
>> it.
>>
>> It's interesting that there is a related comment in row.Scan 
>> ,
>>  
>> which prevents the use of sql.RawBytes because it always closes the 
>> underlying rows before returning.
>>
>> On Thu, 21 Jul 2022 at 20:02, Ian Lance Taylor  wrote:
>>
>>> On Thu, Jul 21, 2022 at 11:02 AM Michal Hruby  
>>> wrote:
>>> >
>>> > Hello, I have a code snippet equivalent to this one:
>>> >
>>> > rows, err := stmt.QueryContext(ctx)
>>> > if err != nil {
>>> > return info, nil, err
>>> > }
>>> > defer rows.Close()
>>> >
>>> > var data sql.RawBytes
>>> > for rows.Next() {
>>> > err = rows.Scan(&data)
>>> > if err != nil {
>>> > return nil, err
>>> > }
>>> > // if ctx is canceled around this point, rows.Close() will be 
>>> called and the data can e overwritten, causing a data race
>>> > _ = data[0] // <--- possible concurrent read here and write inside 
>>> driver.Rows.Close()
>>> > }
>>> >
>>> > And as the comments say, if the context is cancelled, there's a 
>>> possibility of a data race where this goroutine is trying to read data[0], 
>>> and another goroutine can be writing to it, cause the sql package calls 
>>> driver.Rows.Close() (from 
>>> https://github.com/golang/go/blob/176b63e7113b82c140a4ecb2620024526c2c42e3/src/database/sql/sql.go#L2974
>>>  
>>> )
>>> >
>>> > I've opened an issue about this on github ( 
>>> https://github.com/golang/go/issues/53970 ), but was told that's not 
>>> the proper forum to talk about data races.
>>> >
>>> > Any help would be appreciated, thanks.
>>>
>>> I don't quite understand what you are asking.  I think you're correct
>>> that there is a data race there.  It seems to me that the answer is to
>>> not cancel the context.
>>>
>>> What kind of answer are you looking for?
>>>
>>> Ian
>>>
>>> -- 
>>> 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/CAOyqgcUwGN5b-DEwCqLRu6kWwpAnCvO7o6u5TjzS3bmbUgksdw%40mail.gmail.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/b23b3a7b-0582-4891-bd7d-1eaaf57f821dn%40googlegroups.com.


[go-nuts] Generic array and slice type options

2023-01-08 Thread Daniel Theophanes
When playing around with generics, I ran into what I perceive as an odd 
limitation.

I forked an audio package "beep" to do some fun generics with it.
https://github.com/kardianos/beep/blob/master/interface.go

I was trying to use the following interfaces:

type Point[S Size] interface {
// NOTE: Uncommenting the next line will result in errors.
   // [1]S | [2]S
   [2]S
}

type Size interface {
   float64 | float32
}

I was thinking I could change the internal data structure from float64 or 
float32. This part works. I was thinking I could change the internal data 
structure from one channel to two with [1]S | [2]S. Now I realize this 
probably isn't a great idea to begin with, but hear me out...

When I try to change to a union between len 1 array to len 2 array:
 1. I cannot compile any access to point[1] even if behind a len(point) 
guard.
 2. "for range point" appears to stop working at all, though I feel like it 
should still work, as it would work on either data type.

I fully get why this is probably not a good serious approach, but more then 
anything, could someone help me with the why of the compiler errors? The 
specific error is "(P has no core type)".

Thank you,
-Daniel

-- 
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/1c54e3be-8ba9-4991-9051-5946f2e3b495n%40googlegroups.com.


Re: [go-nuts] Generic array and slice type options

2023-01-09 Thread Daniel Theophanes
Thank you Ian.

On Sun, Jan 8, 2023 at 10:40 PM Ian Lance Taylor  wrote:

> On Sun, Jan 8, 2023 at 1:17 PM Daniel Theophanes 
> wrote:
> >
> > When playing around with generics, I ran into what I perceive as an odd
> limitation.
> >
> > I forked an audio package "beep" to do some fun generics with it.
> > https://github.com/kardianos/beep/blob/master/interface.go
> >
> > I was trying to use the following interfaces:
> >
> > type Point[S Size] interface {
> > // NOTE: Uncommenting the next line will result in errors.
> >// [1]S | [2]S
> >[2]S
> > }
> >
> > type Size interface {
> >float64 | float32
> > }
> >
> > I was thinking I could change the internal data structure from float64
> or float32. This part works. I was thinking I could change the internal
> data structure from one channel to two with [1]S | [2]S. Now I realize this
> probably isn't a great idea to begin with, but hear me out...
> >
> > When I try to change to a union between len 1 array to len 2 array:
> >  1. I cannot compile any access to point[1] even if behind a len(point)
> guard.
> >  2. "for range point" appears to stop working at all, though I feel like
> it should still work, as it would work on either data type.
> >
> > I fully get why this is probably not a good serious approach, but more
> then anything, could someone help me with the why of the compiler errors?
> The specific error is "(P has no core type)".
>
> Well, that error is why.  In the current spec and implementation,
> certain operations are only available if the type parameter has a
> "core type".  See https://go.dev/ref/spec#Core_types .  I believe that
> over time we can move toward a more flexible spec and implementation
> that doesn't rely on that concept, but doing that will require
> defining the notion of a dependent type--a type that depends on a type
> parameter.
>
> Ian
>

-- 
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/CAM5gecsBdxzRghDRqJvN0BML1cWciest60pv3wCwsJnCxOx0XA%40mail.gmail.com.


[go-nuts] Re: Reading .xls file with golang

2023-02-24 Thread Daniel Theophanes
There isn't a good XLS reader. I had to fork that version here:
https://pkg.go.dev/github.com/kardianos/xls

It still has issues, but it is better then the previous version.

On Wednesday, February 15, 2023 at 7:55:26 AM UTC-6 Amnon wrote:

> File an issue at https://github.com/extrame/xls/issues
> and maybe submit a fix?
>
> On Wednesday, 15 February 2023 at 03:22:30 UTC Aadi Sharma wrote:
>
>> While reading .xls file with golang using  *ReadAllCells *function  from 
>> xls package 
>> https://github.com/extrame/xls/blob/v0.0.1/workbook.go#L268
>>
>> Issue - For strings it works fine , but for the cell having int value 
>> get's changed to date&time format. 
>> ex:- (*1* get changed to *1900-01-01T00:00:00Z*)
>>
>> How we will deal with this ?
>>
>

-- 
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/3e9bc3bc-9cf8-4282-8516-95da7563c8c0n%40googlegroups.com.


[go-nuts] New type in generics

2024-01-13 Thread Daniel Theophanes
I have a situation where I would like to create a type, then set a property 
on it within a container. To set the type, I envisioned using a method 
"SetName" which would need to take a pointer receiver: (goplay share is 
down right now so I'll post inline:
type Namer interface {
SetName(name string)
}

I wish to create a new Namer type as well, ideally without using reflect. 
If I use [*Ob ] as the type parameter, that works, but then `new(T)` 
returns `**Ob`, which I can deference to get `*Ob`, but then the value is 
nil (Ob isn't created).

I'm working around this, but it surprised me, the interaction of a pointer 
receiver interface type constraint and then I can't create the desired type.

```
package main

import "fmt"

func main() {
ar := NewAppResult()
fmt.Printf("AR: %#v\n", *ar)
ar.Observation.Get("X1")
}

type Ob struct {
Gene  string
Value string
}

func (o *Ob) SetName(name string) {
// o is nil and this will panic.
o.Gene = name
}

type Namer interface {
SetName(name string)
}

type OrderedLookup[T Namer] struct {
List   []T
lookup map[string]T
}

func (ol *OrderedLookup[T]) Get(name string) T {
v, ok := ol.lookup[name]
if !ok {
var v T // T is a pointer, new(T) creates **Ob, but I cant use generic type 
of [Ob] because then Namer
v.SetName(name)
ol.lookup[name] = v
ol.List = append(ol.List, v)
}
return v
}

type AppResult struct {
Observation *OrderedLookup[*Ob]
}

func NewAppResult() *AppResult {
return &AppResult{
Observation: &OrderedLookup[*Ob]{},
}
}
```



-- 
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/8d0c816c-c332-4b44-87e3-9259ad173afcn%40googlegroups.com.


Re: [go-nuts] New type in generics

2024-01-13 Thread Daniel Theophanes
Thank you. Yeah, that seems overly complicated. I can allocate interior to 
the generic object, but I can't use pointer-receiver methods, which is fine 
in my case, I'll just adjust the interior manually.

Thank you.
On Saturday, January 13, 2024 at 1:50:17 PM UTC-6 Axel Wagner wrote:

> The way to do that is to add another level of indirection (as everything 
> in Software Engineering):
>
> type Namer[T any] interface {
> *T
> SetName(name string)
> }
> func WithName[T any, PT Namer[T]](name string) T {
> var v T
> PT(&v).SetName(name)
> return v
> }
>
> I will say, though, that it's not unlikely that you'll be happier if you 
> don't do this and instead accept a plain interface value and let the caller 
> allocate the value and pass in a pointer. But if you want to do it, this is 
> the way.
>
> On Sat, Jan 13, 2024 at 8:10 PM Daniel Theophanes  
> wrote:
>
>> I have a situation where I would like to create a type, then set a 
>> property on it within a container. To set the type, I envisioned using a 
>> method "SetName" which would need to take a pointer receiver: (goplay share 
>> is down right now so I'll post inline:
>> type Namer interface {
>> SetName(name string)
>> }
>>
>> I wish to create a new Namer type as well, ideally without using reflect. 
>> If I use [*Ob ] as the type parameter, that works, but then `new(T)` 
>> returns `**Ob`, which I can deference to get `*Ob`, but then the value is 
>> nil (Ob isn't created).
>>
>> I'm working around this, but it surprised me, the interaction of a 
>> pointer receiver interface type constraint and then I can't create the 
>> desired type.
>>
>> ```
>> package main
>>
>> import "fmt"
>>
>> func main() {
>> ar := NewAppResult()
>> fmt.Printf("AR: %#v\n", *ar)
>> ar.Observation.Get("X1")
>> }
>>
>> type Ob struct {
>> Gene  string
>> Value string
>> }
>>
>> func (o *Ob) SetName(name string) {
>> // o is nil and this will panic.
>> o.Gene = name
>> }
>>
>> type Namer interface {
>> SetName(name string)
>> }
>>
>> type OrderedLookup[T Namer] struct {
>> List   []T
>> lookup map[string]T
>> }
>>
>> func (ol *OrderedLookup[T]) Get(name string) T {
>> v, ok := ol.lookup[name]
>> if !ok {
>> var v T // T is a pointer, new(T) creates **Ob, but I cant use generic 
>> type of [Ob] because then Namer
>> v.SetName(name)
>> ol.lookup[name] = v
>> ol.List = append(ol.List, v)
>> }
>> return v
>> }
>>
>> type AppResult struct {
>> Observation *OrderedLookup[*Ob]
>> }
>>
>> func NewAppResult() *AppResult {
>> return &AppResult{
>> Observation: &OrderedLookup[*Ob]{},
>> }
>> }
>> ```
>>
>>
>>
>> -- 
>> 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/8d0c816c-c332-4b44-87e3-9259ad173afcn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/8d0c816c-c332-4b44-87e3-9259ad173afcn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/5be36388-7bdf-4baa-8fba-15330a42e409n%40googlegroups.com.