in Education by
I am trying to create a "feature branch" from golang. The following code is not working: reader := bufio.NewReader(os.Stdin) fmt.Print(color.RedString("New feature description: ")) featureName, _ := reader.ReadString('\n') featureName = strings.ReplaceAll(featureName, " ", "-") featureBranchName := "feature/" + featureName cmdStartBranch := "git" arguments := []string{"checkout", "-b", featureBranchName} if _, err := exec.Command(cmdStartBranch, arguments...).Output(); err != nil { fmt.Println(color.RedString(err.Error())) os.Exit(1) } But hardcoding featureBranchName it works: cmdStartBranch := "git" arguments := []string{"checkout", "-b", "feature/ciaone-proprio"} if _, err := exec.Command(cmdStartBranch, arguments...).Output(); err != nil { fmt.Println(color.RedString(err.Error())) os.Exit(1) } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
ReadString('\n') returns the delimiter '\n', you need to remove it. featureName, err := reader.ReadString('\n') if err == nil { n := len(featureName) featureName = featureName[:n-1] } ...

Related questions

0 votes
    I've been experimenting with cronjobs recently and have it setup like so: crontab: SHELL=/bin/sh MAILTO= ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    What is git diff command? How is it different from git status?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    Having a Golang project and Go workspace. I'm trying to run my test, but I'm having the following ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    The Function Key F5 is used in a webpage to___________the page (a) Exit (b) Create another window (c) Reload (d) Add a new tab Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of ... staging * etc... Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    How can we see the differences between the two branches in Git?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How to clone all remote branches in Git?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    What is the difference between the ‘git diff ’and ‘git status’?...
asked Nov 2, 2020 in Technology by JackTerrance
0 votes
    Currently I am working on this code: customer_telno = customer.find('div', 'customer_phone_number') customer_telno = ... this problem? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128) ... anything which works consistently. Can anyone solve this problem?...
asked Nov 20, 2020 in Education by Editorial Staff
0 votes
    From where break statement causes an exit? (a) Only from innermost loop (b) Terminates a program (c ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    So I am trying to build a docker image with the Golang SDK, everything runs except the section in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I'm relatively new to go, and I'm looking for a rough equivalent (library or implementation) of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    I'm relatively new to go, and I'm looking for a rough equivalent (library or implementation) of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I use "github.com/streadway/amqp" for async processing requests via queue (RabbitMQ). And I use "github ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
...