1
Question about string and []string. Might require append()? Help me simplify this.
Post Body
I have a segment of code that is dealing with strings and string slices. I have an external go file that is used entirely for config purposes, and am attempting to pull in the elements of a string slice from it to the main source file. The code I want to simplify is:
args := []string{"-dmS", screenname}
args = append(args, invocation...)
args = append(args, rootdir servername "/" "server.jar")
Where screenname, rootdir, and servername are all strings, and invocation is a []string. Ultimately, I want args to contain all the elements of invocation, but be sandwiched on both sides by my other data.
How do I simplify this into something succinct and usable? This code as it is works, it's just ugly as all hell and I know that it's only this gross through my own inexperience.
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
31,006
Link Karma
8,896
Comment Karma
22,110
Profile updated: 5 days ago
Posts updated: 8 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/golang/comm...