Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Keystone
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
Container 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
Show more breadcrumbs
Third Party Mirrors
Keystone
Commits
99b4ce91
Commit
99b4ce91
authored
8 years ago
by
Nguyen Anh Quynh
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #236 from zchee/go/sample
go: Update to latest keystone package API & Remove unnecessary else
parents
f8a3eba0
5e01dd06
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/go/keystone/samples/main.go
+12
-12
12 additions, 12 deletions
bindings/go/keystone/samples/main.go
with
12 additions
and
12 deletions
bindings/go/keystone/samples/main.go
+
12
−
12
View file @
99b4ce91
...
...
@@ -8,25 +8,25 @@ import (
"fmt"
"os"
keystone
"github.com/keystone-engine/
beta
/bindings/go/keystone"
"github.com/keystone-engine/
keystone
/bindings/go/keystone"
)
func
main
()
{
assembly
:=
os
.
Args
[
1
]
if
ks
,
err
:=
keystone
.
New
(
keystone
.
ArchitectureX86
,
keystone
.
Mode32
);
err
!=
nil
{
ks
,
err
:=
keystone
.
New
(
keystone
.
ARCH_X86
,
keystone
.
MODE_32
)
if
err
!=
nil
{
panic
(
err
)
}
else
{
defer
ks
.
Close
()
}
defer
ks
.
Close
()
if
err
:=
ks
.
Option
(
keystone
.
O
ptionSyntax
,
keystone
.
O
ptionSyntaxIntel
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Could not set syntax option to intel"
))
}
if
err
:=
ks
.
Option
(
keystone
.
O
PT_SYNTAX
,
keystone
.
O
PT_SYNTAX_INTEL
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Could not set syntax option to intel"
))
}
if
insn
,
_
,
ok
:=
ks
.
Assemble
(
assembly
,
0
);
!
ok
{
panic
(
fmt
.
Errorf
(
"Could not assemble instruction"
))
}
else
{
fmt
.
Printf
(
"%s: [%x]"
,
assembly
,
insn
)
}
if
insn
,
_
,
ok
:=
ks
.
Assemble
(
assembly
,
0
);
!
ok
{
panic
(
fmt
.
Errorf
(
"Could not assemble instruction"
))
}
else
{
fmt
.
Printf
(
"%s: [%x]"
,
assembly
,
insn
)
}
}
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