Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
44a8642a
Commit
44a8642a
authored
Sep 08, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b54a37a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
t/pkt.go
t/pkt.go
+1
-1
t/pktgen.go
t/pktgen.go
+14
-3
No files found.
t/pkt.go
View file @
44a8642a
...
@@ -7,6 +7,6 @@ type Header struct {
...
@@ -7,6 +7,6 @@ type Header struct {
}
}
type
Notify
struct
{
type
Notify
struct
{
//
Header
Header
Message
string
Message
string
}
}
t/pktgen.go
View file @
44a8642a
// TODO text what it does (generates code for pkt.go)
// +build ignore
package
main
package
main
import
(
import
(
...
@@ -20,7 +24,9 @@ func main() {
...
@@ -20,7 +24,9 @@ func main() {
ncode
:=
0
ncode
:=
0
//ast.Print(fset, f)
// ast.Print(fset, f)
// return
for
_
,
decl
:=
range
f
.
Decls
{
for
_
,
decl
:=
range
f
.
Decls
{
// we look for types (which can be only under GenDecl)
// we look for types (which can be only under GenDecl)
gdecl
,
ok
:=
decl
.
(
*
ast
.
GenDecl
)
gdecl
,
ok
:=
decl
.
(
*
ast
.
GenDecl
)
...
@@ -57,9 +63,14 @@ func main() {
...
@@ -57,9 +63,14 @@ func main() {
panic
(
fmt
.
Sprintf
(
"%#v not supported"
,
fieldv
.
Type
))
panic
(
fmt
.
Sprintf
(
"%#v not supported"
,
fieldv
.
Type
))
}
}
if
len
(
fieldv
.
Names
)
!=
0
{
for
_
,
field
:=
range
fieldv
.
Names
{
for
_
,
field
:=
range
fieldv
.
Names
{
fmt
.
Printf
(
"%s(%d).%s
\t
%s
\n
"
,
tname
,
ncode
,
field
.
Name
,
ftype
)
fmt
.
Printf
(
"%s(%d).%s
\t
%s
\n
"
,
tname
,
ncode
,
field
.
Name
,
ftype
)
}
}
}
else
{
// no names means embedding
fmt
.
Printf
(
"%s(%d).<%s>
\n
"
,
tname
,
ncode
,
ftype
)
}
}
}
ncode
++
ncode
++
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment