Giter VIP home page Giter VIP logo

Comments (6)

scottdware avatar scottdware commented on July 30, 2024

Yup, you are correct! Thanks for catching that! I’ll have it fixed in the morning!

Sent with GitHawk

from go-junos.

scottdware avatar scottdware commented on July 30, 2024

Should be all set!

from go-junos.

MaxBear avatar MaxBear commented on July 30, 2024

Thanks for fixing this. I have some question about why using an array for message, since you are only taking the first array element as commit message, why not just use a string ?

`
func (j *Junos) CommitAt(time string, message ...string) error {
var errs commitResults
command := fmt.Sprintf(rpcCommitAt, time)

if len(message) > 0 {
	command = fmt.Sprintf(rpcCommitAtLog, time, message[0])
}

`

from go-junos.

scottdware avatar scottdware commented on July 30, 2024

So, this is more so a functionality of Golang and trying to use "optional" parameters in functions. I could just have a static param, and check to see if it's set like:

CommitAt(time string, message string)

...

if len(message) > 0 { do stuff }

But I wanted to make the function easier on the user so that if they forgot to put a message by some chance, it wouldn't error out at them. If the last parameter is a ...string then that means you could have many optional parameters, but they would all be message[0], message[1], ... etc.

from go-junos.

MaxBear avatar MaxBear commented on July 30, 2024

... i think i understand .... message[0] for commit message and other parameters for other purposes, is this right ?

from go-junos.

scottdware avatar scottdware commented on July 30, 2024

Yup, you got it.

from go-junos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.