blog
Table des matières
- 2026:
- 2025:
12 billet(s) pour novembre 2026
| Notes conversion JSON YAML | 2026/11/13 11:16 | Jean-Baptiste |
| Git commit perdu | 2026/11/12 18:16 | Jean-Baptiste |
| Notes mojo lang | 2026/11/11 20:34 | Jean-Baptiste |
| Notes rust lang compilation | 2026/11/11 18:35 | Jean-Baptiste |
| Mémoire VSIZE VMSIZE SEGV lang C | 2026/11/11 15:59 | Jean-Baptiste |
| Ansible-navigator utilisation de ansible-vault | 2026/11/06 11:33 | Jean-Baptiste |
| Err Ansible - Module result deserialization failed No start of json char found | 2026/11/06 09:09 | Jean-Baptiste |
| Script Python conversion JSON vers CSV | 2026/11/06 08:14 | Jean-Baptiste |
| Filter Incoming IPv4 Packets Containing IP Options - cve-2026-98432 mitigation - Kernel TCP Use-After-Free | 2026/11/04 21:04 | Jean-Baptiste |
| Notes ZFS | 2026/11/03 18:04 | Jean-Baptiste |
| Diff image container | 2026/11/03 16:30 | Jean-Baptiste |
| Notes processus multi-thread | 2026/11/03 10:59 | Jean-Baptiste |
Go lang - GUI
Par nature Go n'est pas orienté utilisateur.
L'interface graphique “naturelle” à Go est le Web (WebUI)
Cependant il est possible d'utiliser :
- Tk9 https://pkg.go.dev/modernc.org/tk9.0 pour des applis simple et portable CGo-free il est vraiment natif Go et crossplatform
- Qt avec https://github.com/mappu/miqt Qt est la référence
- Wails projet prometteur, mais pas compatible pour les anciennes versions. nécessite Node (Svelte, React, Vue, Preact, Lit, Vanilla)
- Flutter : Pour Android
Qt - miqt
package main import ( "fmt" "os" "github.com/mappu/miqt/qt" ) func main() { qt.NewQApplication(os.Args) btn := qt.NewQPushButton3("Hello world!") btn.SetFixedWidth(320) var counter int = 0 btn.OnPressed(func() { counter++ btn.SetText(fmt.Sprintf("You have clicked the button %d time(s)", counter)) }) btn.Show() qt.QApplication_Exec() fmt.Println("OK!") }
Go lang - err compilation pour windows - crosscompilation
$ env GOOS=windows go build main.go # github.com/mappu/miqt/qt ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qaccessible_64bit.go:6:33: undefined: QAccessible__RelationFlag ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qgraphicsitem_64bit.go:6:36: undefined: QGraphicsItem__Extension ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:6:28: undefined: KeyboardModifier ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:7:21: undefined: Modifier ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:8:23: undefined: MouseButton ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:9:34: undefined: WindowType ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:10:22: undefined: InputMethodQuery ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:11:18: undefined: InputMethodQuery ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:12:29: undefined: InputMethodHint ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:13:23: undefined: GestureType ../../pkg/mod/github.com/mappu/miqt@v0.13.0/qt/gen_qnamespace_64bit.go:13:23: too many errors
$ env CGO_ENABLED=1 GOOS=windows go build main.go # runtime/cgo gcc: error: unrecognized command-line option ‘-mthreads’; did you mean ‘-pthread’? ...
$ env GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_LDFLAGS="-lssp" go build -ldflags="-s -w" -o app1.exe main.go github.com/mappu/miqt/qt: exec: "i686-w64-mingw32-g++": executable file not found in $PATH ...
#sudo apt-get install gcc-multilib-i686-linux-gnu sudo apt-get install gcc-mingw-w64-bootstrap
$ env GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_LDFLAGS="-lssp" go build -ldflags="-s -w" -o app1.exe main.go
...
# github.com/mappu/miqt/qt
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qatomic.h:41,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/qrefcount.h:43,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:44,
from /usr/include/x86_64-linux-gnu/qt5/QtCore/QByteArray:1,
from gen_qxmlstream.cpp:1:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:45:12: fatal error: type_traits: No such file or directory
45 | # include <type_traits>
| ^~~~~~~~~~~~~
compilation terminated.
Test en 64 bits :
sudo apt-get install gcc-mingw-w64-x86-64-win32 sudo apt-get install g++-mingw-w64-x86-64-win32
rm /tmp/go-* -rf go clean -cache -modcache -fuzzcache
env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_LDFLAGS="-lssp" go build -ldflags="-s -w" -o app1.exe main.go
... 3755312453/000657.o /tmp/go-link-3755312453/000658.o /tmp/go-link-3755312453/000659.o /tmp/go-link-3755312453/000660.o /tmp/go-link-3755312453/000661.o /tmp/go-link-3755312453/000662.o /tmp/go-link-3755312453/000663.o /tmp/go-link-3755312453/000664.o /tmp/go-link-3755312453/000665.o /tmp/go-link-3755312453/000666.o /tmp/go-link-3755312453/000667.o /tmp/go-link-3755312453/000668.o /tmp/go-link-3755312453/000669.o /tmp/go-link-3755312453/000670.o /tmp/go-link-3755312453/000671.o /tmp/go-link-3755312453/000672.o /tmp/go-link-3755312453/000673.o /tmp/go-link-3755312453/000674.o /tmp/go-link-3755312453/000675.o /tmp/go-link-3755312453/000676.o /tmp/go-link-3755312453/000677.o /tmp/go-link-3755312453/000678.o /tmp/go-link-3755312453/000679.o /tmp/go-link-3755312453/000680.o /tmp/go-link-3755312453/000681.o /tmp/go-link-3755312453/000682.o /tmp/go-link-3755312453/000683.o /tmp/go-link-3755312453/000684.o /tmp/go-link-3755312453/000685.o /tmp/go-link-3755312453/000686.o /tmp/go-link-3755312453/000687.o /tmp/go-link-3755312453/000688.o /tmp/go-link-3755312453/000689.o /tmp/go-link-3755312453/000690.o -lssp -lQt5Widgets -lQt5Gui -lQt5Core -lssp -lssp -Wl,-T,/tmp/go-link-3755312453/fix_debug_gdb_scripts.ld -Wl,--start-group -lmingwex -lmingw32 -Wl,--end-group -lkernel32 /usr/bin/x86_64-w64-mingw32-ld.bfd: cannot find -lQt5Widgets: No existe el fichero o el directorio /usr/bin/x86_64-w64-mingw32-ld.bfd: cannot find -lQt5Gui: No existe el fichero o el directorio /usr/bin/x86_64-w64-mingw32-ld.bfd: cannot find -lQt5Core: No existe el fichero o el directorio collect2: error: ld returned 1 exit status
Go lang - template - gotemplate
// Source - https://stackoverflow.com/a/59083271 // Posted by wasmup, modified by community. See post 'Timeline' for change history // Retrieved 2026-05-03, License - CC BY-SA 4.0 package main import ( "fmt" "os" "text/template" ) func main() { name := "AlphaGo" fmt.Printf("I am %s\n", name) t := template.Must(template.New("my").Parse("I am {{.Name}}\n")) t.Execute(os.Stdout, struct{ Name string }{name}) // I am AlphaGo t2 := template.Must(template.New("my").Parse("I am {{.name}}\n")) t2.Execute(os.Stdout, map[string]string{"name": name}) // I am AlphaGo t3 := template.Must(template.New("my").Parse("I am {{.}}\n")) t3.Execute(os.Stdout, name) // I am AlphaGo }
Go lang - if x in list
Source : https://stackoverflow.com/questions/15323767/does-go-have-if-x-in-construct-similar-to-python
Since Go 1.18 or newer, you can use slices.Contains.
func main() { liste1 := []string{"Meow", "Waf", "Moo"} if !slices.Contains(liste1, "Waff") { fmt.Println("Aucun chien trouvé") } else { fmt.Println("Un chien a été trouvé") } }
Before Go 1.18 there was no built-in operator. You needed to iterate over the array. You had to write your own function to do it, like this:
func stringInSlice(a string, list []string) bool { for _, b := range list { if b == a { return true } } return false }
Pascal Lazarus - Compilation croisée dans un conteneur
Création de l'image conteneur
git clone --depth=1 https://github.com/ChrisWiGit/lazarus-docker cd lazarus-docker podman build -t lazarus-docker .
Paramètre de compilation
cat > runenv.sh <<'EOF' #! /bin/bash cd /project lazbuildl64 *.lpr && install -d build/linux64/ && mv project1 /project/build/linux64/ lazbuildw32 *.lpr && install -d build/win32/ && mv project1.exe /project/build/win32/ lazbuildw64 *.lpr && install -d build/win64/ && mv project1.exe /project/build/win64/ EOF chmod +x runenv.sh
Compilation
podman run -v $PWD:/project --rm localhost/lazarus-docker:latest /project/runenv.sh
Suppression des symboles et info de debug pour réduire la taille des fichiers :
strip build/*/*
blog.txt · Dernière modification : de 127.0.0.1
