Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
e919f681
Commit
e919f681
authored
May 22, 2024
by
Michael Yang
Browse files
lint windows
parent
bf7edb0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
app/lifecycle/server_windows.go
app/lifecycle/server_windows.go
+4
-2
app/tray/wintray/eventloop.go
app/tray/wintray/eventloop.go
+2
-3
app/tray/wintray/tray.go
app/tray/wintray/tray.go
+3
-7
gpu/amd_windows.go
gpu/amd_windows.go
+1
-1
No files found.
app/lifecycle/server_windows.go
View file @
e919f681
...
...
@@ -24,7 +24,8 @@ func terminate(cmd *exec.Cmd) error {
if
err
!=
nil
{
return
err
}
defer
dll
.
Release
()
// nolint: errcheck
//nolint:errcheck
defer
dll
.
Release
()
pid
:=
cmd
.
Process
.
Pid
...
...
@@ -73,7 +74,8 @@ func isProcessExited(pid int) (bool, error) {
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"failed to open process: %v"
,
err
)
}
defer
windows
.
CloseHandle
(
hProcess
)
// nolint: errcheck
//nolint:errcheck
defer
windows
.
CloseHandle
(
hProcess
)
var
exitCode
uint32
err
=
windows
.
GetExitCodeProcess
(
hProcess
,
&
exitCode
)
...
...
app/tray/wintray/eventloop.go
View file @
e919f681
...
...
@@ -47,7 +47,6 @@ func nativeLoop() {
default
:
pTranslateMessage
.
Call
(
uintptr
(
unsafe
.
Pointer
(
m
)))
//nolint:errcheck
pDispatchMessage
.
Call
(
uintptr
(
unsafe
.
Pointer
(
m
)))
//nolint:errcheck
}
}
}
...
...
@@ -160,8 +159,8 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
lResult
,
_
,
_
=
pDefWindowProc
.
Call
(
uintptr
(
hWnd
),
uintptr
(
message
),
uintptr
(
wParam
)
,
uintptr
(
lParam
)
,
wParam
,
lParam
,
)
}
return
...
...
app/tray/wintray/tray.go
View file @
e919f681
...
...
@@ -186,7 +186,7 @@ func (t *winTray) initInstance() error {
t
.
muNID
.
Lock
()
defer
t
.
muNID
.
Unlock
()
t
.
nid
=
&
notifyIconData
{
Wnd
:
windows
.
Handle
(
t
.
window
)
,
Wnd
:
t
.
window
,
ID
:
100
,
Flags
:
NIF_MESSAGE
,
CallbackMessage
:
t
.
wmSystrayMessage
,
...
...
@@ -197,7 +197,6 @@ func (t *winTray) initInstance() error {
}
func
(
t
*
winTray
)
createMenu
()
error
{
menuHandle
,
_
,
err
:=
pCreatePopupMenu
.
Call
()
if
menuHandle
==
0
{
return
err
...
...
@@ -246,7 +245,7 @@ func (t *winTray) addOrUpdateMenuItem(menuItemId uint32, parentId uint32, title
mi
:=
menuItemInfo
{
Mask
:
MIIM_FTYPE
|
MIIM_STRING
|
MIIM_ID
|
MIIM_STATE
,
Type
:
MFT_STRING
,
ID
:
uint32
(
menuItemId
)
,
ID
:
menuItemId
,
TypeData
:
titlePtr
,
Cch
:
uint32
(
len
(
title
)),
}
...
...
@@ -302,11 +301,10 @@ func (t *winTray) addOrUpdateMenuItem(menuItemId uint32, parentId uint32, title
}
func
(
t
*
winTray
)
addSeparatorMenuItem
(
menuItemId
,
parentId
uint32
)
error
{
mi
:=
menuItemInfo
{
Mask
:
MIIM_FTYPE
|
MIIM_ID
|
MIIM_STATE
,
Type
:
MFT_SEPARATOR
,
ID
:
uint32
(
menuItemId
)
,
ID
:
menuItemId
,
}
mi
.
Size
=
uint32
(
unsafe
.
Sizeof
(
mi
))
...
...
@@ -426,7 +424,6 @@ func iconBytesToFilePath(iconBytes []byte) (string, error) {
// Loads an image from file and shows it in tray.
// Shell_NotifyIcon: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159(v=vs.85).aspx
func
(
t
*
winTray
)
setIcon
(
src
string
)
error
{
h
,
err
:=
t
.
loadIconFrom
(
src
)
if
err
!=
nil
{
return
err
...
...
@@ -444,7 +441,6 @@ func (t *winTray) setIcon(src string) error {
// Loads an image from file to be shown in tray or menu item.
// LoadImage: https://msdn.microsoft.com/en-us/library/windows/desktop/ms648045(v=vs.85).aspx
func
(
t
*
winTray
)
loadIconFrom
(
src
string
)
(
windows
.
Handle
,
error
)
{
// Save and reuse handles of loaded images
t
.
muLoadedImages
.
RLock
()
h
,
ok
:=
t
.
loadedImages
[
src
]
...
...
gpu/amd_windows.go
View file @
e919f681
...
...
@@ -65,7 +65,7 @@ func AMDGetGPUInfo() []GpuInfo {
slog
.
Debug
(
"detected hip devices"
,
"count"
,
count
)
// TODO how to determine the underlying device ID when visible devices is causing this to subset?
for
i
:=
0
;
i
<
count
;
i
++
{
for
i
:=
range
count
{
err
=
hl
.
HipSetDevice
(
i
)
if
err
!=
nil
{
slog
.
Warn
(
"set device"
,
"id"
,
i
,
"error"
,
err
)
...
...
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