Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rcom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Global Dynamic Exposure
rabotnik
rcom
Commits
fcce36dd
Commit
fcce36dd
authored
4 years ago
by
Felix Delattre
Browse files
Options
Downloads
Patches
Plain Diff
Added basic command line argument for buildingId
parent
3ce78369
Branches
feature/add-command-line
No related tags found
No related merge requests found
Pipeline
#19494
failed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.go
+9
-0
9 additions, 0 deletions
main.go
main_test.go
+21
-1
21 additions, 1 deletion
main_test.go
with
30 additions
and
1 deletion
main.go
+
9
−
0
View file @
fcce36dd
...
...
@@ -21,6 +21,7 @@
package
main
import
(
"flag"
"log"
)
...
...
@@ -29,4 +30,12 @@ import (
*/
func
main
()
{
log
.
Println
(
"Hello world"
)
// Read command line argument for buildingId
buildingIdPointer
:=
flag
.
Int64
(
"building"
,
0
,
"set building ID"
)
flag
.
Parse
()
// Initiate variables
buildingId
:=
*
buildingIdPointer
log
.
Println
(
"buildingId: "
,
buildingId
)
}
This diff is collapsed.
Click to expand it.
main_test.go
+
21
−
1
View file @
fcce36dd
...
...
@@ -21,12 +21,32 @@
package
main
import
(
"bytes"
"flag"
"testing"
)
func
TestMain
(
t
*
testing
.
T
)
{
type
Config
struct
{
building
int64
args
[]
string
}
func
parseFlags
(
t
*
testing
.
T
)
{
err
:=
error
(
nil
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
flags
:=
flag
.
NewFlagSet
(
"rcli"
,
flag
.
ContinueOnError
)
var
buf
bytes
.
Buffer
flags
.
SetOutput
(
&
buf
)
var
stringArray
=
[
2
]
string
var
conf
Config
flags
.
Int64Var
(
&
conf
.
building
,
"building"
,
1
,
"set building ID"
)
err
=
flags
.
Parse
()
if
err
!=
nil
{
return
nil
,
buf
.
String
(),
err
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment