Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
i3going-on
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
Model registry
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
Show more breadcrumbs
Kevin Lyda
i3going-on
Commits
680a825b
Unverified
Commit
680a825b
authored
2 years ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Successfully receiving clicks.
parent
7114ebc3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bar/clicks.go
+5
-3
5 additions, 3 deletions
bar/clicks.go
bar/run.go
+2
-2
2 additions, 2 deletions
bar/run.go
with
7 additions
and
5 deletions
bar/clicks.go
+
5
−
3
View file @
680a825b
...
...
@@ -24,18 +24,20 @@ func handleCommands(clicks chan modules.Click) {
if
err
!=
nil
{
continue
}
objReader
:=
strings
.
NewReader
(
strings
.
Trim
(
object
,
","
))
object
=
strings
.
Trim
(
object
,
"[,
\n
"
)
logger
.
WriteString
(
fmt
.
Sprintf
(
"Got an object: <<%s>>
\n
"
,
object
))
objReader
:=
strings
.
NewReader
(
object
)
clickParser
:=
yaml
.
NewDecoder
(
objReader
)
click
:=
modules
.
Click
{}
err
=
clickParser
.
Decode
(
&
click
)
if
err
!=
nil
{
logger
.
WriteString
(
fmt
.
Sprintf
(
"Error on click: %
s
\n
"
,
err
))
logger
.
WriteString
(
fmt
.
Sprintf
(
"Error on click: %
#v
\n
"
,
err
))
clicks
<-
modules
.
Click
{
Name
:
fmt
.
Sprintf
(
"ERROR: %s"
,
err
),
}
continue
}
logger
.
WriteString
(
fmt
.
Sprintf
(
"
Error
o
n
click: %
s
\n
"
,
err
))
logger
.
WriteString
(
fmt
.
Sprintf
(
"
Parsed
o
k
click: %
#v
\n
"
,
click
))
clicks
<-
click
}
}
This diff is collapsed.
Click to expand it.
bar/run.go
+
2
−
2
View file @
680a825b
...
...
@@ -39,11 +39,11 @@ func Run(cmd *cobra.Command, args []string) {
for
_
,
module
:=
range
cfg
.
Modules
{
if
click
.
Name
==
module
.
Name
{
found
=
true
fmt
.
Print
(
`[{"full_text": "CLICK!"},{"name": "post", "full_text": "post", "color": "#11ff11"},{"name": "date", "full_text": "22-12-01 22:54"}]`
)
fmt
.
Print
(
`
,
[{"full_text": "CLICK!"},{"name": "post", "full_text": "post", "color": "#11ff11"},{"name": "date", "full_text": "22-12-01 22:54"}]`
)
}
}
if
!
found
{
fmt
.
Print
(
`[{"full_text": "ERROR!"},{"name": "post", "full_text": "post", "color": "#11ff11"},{"name": "date", "full_text": "22-12-01 22:54"}]`
)
fmt
.
Print
(
`
,
[{"full_text": "ERROR!"},{"name": "post", "full_text": "post", "color": "#11ff11"},{"name": "date", "full_text": "22-12-01 22:54"}]`
)
}
time
.
Sleep
(
5
*
time
.
Second
)
case
<-
time
.
After
(
time
.
Duration
(
cfg
.
Refresh
)
*
time
.
Second
)
:
...
...
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