pkg / profile

Simple profiling for Go
BSD 2-Clause "Simplified" License
2k stars 122 forks source link

Make Start accept a published type as arguments. #24

Closed gwatts closed 8 years ago

gwatts commented 8 years ago

This lets you build the arguments to Start dynamically.

eg. cfg := []profile.Config{profile.NoShutdownHook} switch mode { case "cpu": cfg = append(cfg, profile.CPUProfile) case "mem": cfg = append(cfg, profile.MemProfile) case "block": cfg = append(cfg, profile.BlockProfile) default: panic("bad profile mode") }

prof = profile.Start(cfg...) ...

davecheney commented 8 years ago

I don't think this is necessary. Can you please open an issue to describe the problem you are having.

gwatts commented 8 years ago

i thought the example was reasonably clear. I want to build up the common set of parameters ahead of calling Start. I could call Start in each case blocl with the same set of arguments other than one in the switch statement, but that seems overly verbose and redundant.

By making the type private, you prevent me from calling Start using a variadic argument; for my example it's inconvenient.

I also don't understand why you'd just close the PR without discussion - What's the difference between discussing it here vs an issue? At least you have the code and commit message as context here.

davecheney commented 8 years ago

Im sorry for closing the PR, it is my preference for discussing the problem via an issue before proposing code. Please understand I mean no offence by this.

On Tue, 2 Aug 2016, 12:47 Gareth Watts notifications@github.com wrote:

i thought the example was reasonably clear. I want to build up the common set of parameters ahead of calling Start. I could call Start in each case blocl with the same set of arguments other than one in the switch statement, but that seems overly verbose and redundant.

By making the type private, you prevent me from calling Start using a variadic argument; for my example it's inconvenient.

I also don't understand why you'd just close the PR without discussion - What's the difference between discussing it here vs an issue? At least you have the code and commit message as context here.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/pkg/profile/pull/24#issuecomment-236778902, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcA9X1U9P0-V6mjtPT1yHtizzUxtHeks5qbq_DgaJpZM4JaJZ6 .