vulkan-go 中如何利用GLFW中的CreateWindowSurface函数?
积累知识,胜过积蓄金银!毕竟在Golang开发的过程中,会遇到各种各样的问题,往往都是一些细节知识点还没有掌握好而导致的,因此基础知识点的积累是很重要的。下面本文《vulkan-go 中如何利用GLFW中的CreateWindowSurface函数?》,就带大家讲解一下知识点,若是你对本文感兴趣,或者是想搞懂其中某个知识点,就请你继续往下看吧~
我正在尝试使用 go 和 github.com/vulkan-go 绑定创建 vk.surface。
通常glfw.createwindowsurface是用四个参数声明的,比如createwindowsurface(instance interface{}, window *glfw.window, alloccallbacks unsafe.pointer, *vk.surface),这样我们就可以声明一个vk.surface类型的变量并将其地址传递给函数。
但是 vulkan-go 中的 glfw.createwindowsurface 函数是这样声明的 createwindowsurface(instance interface{}, alloccallbacks unsafe.pointer) 并且它不返回 vk.surface 而是一个指向 c 的 unsafe.pointer 的 uintptr .vksurfacekhr。
我尝试通过指针进行钻取,然后将其类型转换为 vk.surface,如下所示 (vk.surface)(unsafe.pointer(surface)),但这并不可行,因为当我稍后将其传递给 vk 时.getphysicaldevicesurfacesupport函数验证层输出错误validation error: [ vuid-vkgetphysicaldevicesurfacesupportkhr-surface-parameter ] object 0: handle = 0x22ce94b8e60, type = vk_object_type_instance; |消息 id = 0x801f247e |无效的 vksurfacekhr 对象 0xc000014148。 vulkan 规范规定:表面必须是有效的 vksurfacekhr 句柄 (https://vulkan.lunarg.com/doc/view/1.3.211.0/windows/1.3-extensions/vkspec.html#vuid-vkgetphysicaldevicesurfacesupportkhr-surface-parameter) .
这是我的代码,有点长,但也许它会帮助您更好地理解我在做什么:
package main
import (
"bytes"
"errors"
"fmt"
"log"
"unsafe"
"github.com/fijosilo/osies/internal/utils"
"github.com/vulkan-go/glfw/v3.3/glfw"
vk "github.com/vulkan-go/vulkan"
)
const debug bool = true
var width int = 1280
var height int = 720
var vulkanSelectedValidationLayers = []string{}
var vulkanSelectedExtensions = []string{}
var vulkanApplicationInfo *vk.ApplicationInfo = nil
var vulkanCreateInstanceInfo *vk.InstanceCreateInfo = nil
var vulkanDebugReportCallbackCreateInfo *vk.DebugReportCallbackCreateInfo = nil
var vulkanDebugReportCallback *vk.DebugReportCallback = new(vk.DebugReportCallback)
func main() {
logFile := utils.SetupLogOutputFile()
defer logFile.Close()
// init glfw
initializeGLFW()
// create the window
window := createGLFWWindow(width, height, "OSIES")
// init vulkan
initializeVulkan()
// create vulkan instance
instance := createVulkanInstance(window)
// setup validations
if debug {
vk.CreateDebugReportCallback(instance, getVulkanDebugReportCallbackCreateInfo(), nil, vulkanDebugReportCallback)
}
// window surface
surface := createVulkanSurface(instance, window)
// select physical device
physicalDevice, queueFamiliesIndices := selectVulkanPhysicalDeviceAndQueueFamily(instance, &surface)
// create logical device
logicalDevice := createVulkanLogicalDevice(physicalDevice, queueFamiliesIndices)
var graphycsQueue vk.Queue
vk.GetDeviceQueue(logicalDevice, queueFamiliesIndices["graphics"], 0, &graphycsQueue)
var surfaceQueue vk.Queue
vk.GetDeviceQueue(logicalDevice, queueFamiliesIndices["surface"], 0, &surfaceQueue)
// loop
for ; !window.ShouldClose() ; {
glfw.PollEvents()
}
// cleanup
vk.DestroyDevice(logicalDevice, nil)
vk.DestroySurface(instance, surface, nil)
if debug {
vk.DestroyDebugReportCallback(instance, *vulkanDebugReportCallback, nil)
}
vk.DestroyInstance(instance, nil)
window.Destroy()
glfw.Terminate()
}
/* Initializes the GLFW api.
*/
func initializeGLFW() {
err := glfw.Init()
if err != nil{
log.Println(err)
panic(err)
}
}
/* Creates and returns a GLFW window.
*/
func createGLFWWindow(width int, height int, title string) *glfw.Window {
glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI)
glfw.WindowHint(glfw.Resizable, glfw.False)
window, err := glfw.CreateWindow(width, height, title, nil, nil)
if err != nil{
log.Println(err)
panic(err)
}
return window
}
/* Initializes the Vulkan api. It requires the GLFW api to be initialized.
*/
func initializeVulkan() {
vk.SetGetInstanceProcAddr(glfw.GetVulkanGetInstanceProcAddress())
err := vk.Init()
if err != nil{
log.Println(err)
panic(err)
}
}
/* Adds the layer to the slice of selected layers if it is not on the slice yet.
It requires the Vulkan api to be initialized.
*/
func selectVulkanValidationLayer(selectedLayer string) {
vulkanSelectedValidationLayers = utils.AppendStringIfNotFound(vulkanSelectedValidationLayers, vk.ToString([]byte(selectedLayer)))
}
/* Returns a slice of strings where each string is the name of a selected and supported vulkan validation layer.
It requires the Vulkan api to be initialized.
*/
func getVulkanValidationLayers(selectedLayers []string) []string {
// get supported layers' count
var supportedLayerCount uint32
result := vk.EnumerateInstanceLayerProperties(&supportedLayerCount, nil)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan validation layers count with error code %d\n", result)
return []string{}
}
// get supported layers' properties
supportedLayerProperties := make([]vk.LayerProperties, supportedLayerCount)
result = vk.EnumerateInstanceLayerProperties(&supportedLayerCount, supportedLayerProperties)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan validation layers with error code %d\n", result)
return []string{}
}
// get supported layers' property name to slice of strings
supportedLayers := make([]string, supportedLayerCount)
for n, layer := range supportedLayerProperties {
layer.Deref()
supportedLayers[n] = vk.ToString(layer.LayerName[:])
}
// filter the selected layers from the supported layers
layers := []string{}
for _, supportedLayer := range supportedLayers {
// find layer in selected layers
found := false
for _, selectedLayer := range selectedLayers {
if selectedLayer == supportedLayer {
found = true
break
}
}
// add selected supported layer to the slice of layers
if found {
layers = append(layers, supportedLayer)
}
}
// debug
if debug {
// log selected validation layers
log.Print("Vulkan selected validation layers:\n")
for _, layer := range selectedLayers {
log.Printf(" %s\n", layer)
}
// log supported validation layers
log.Print("Vulkan supported validation layers:\n")
for _, layer := range supportedLayers {
log.Printf(" %s\n", layer)
}
// log selected and supported validation layers
log.Print("Vulkan selected and supported validation layers:\n")
for _, layer := range layers {
log.Printf(" %s\n", layer)
}
}
return layers
}
/* Adds the extension to the slice of selected extensions if it is not on the slice yet.
It requires the Vulkan api to be initialized.
*/
func selectVulkanExtension(selectedExtension string) {
vulkanSelectedExtensions = utils.AppendStringIfNotFound(vulkanSelectedExtensions, vk.ToString([]byte(selectedExtension)))
}
/* Gets the GLFW required vulkan extensions and adds them to the slice off selected vulkan extensions.
It requires the Vulkan api to be initialized.
*/
func selectGLFWRequiredExtensions(window *glfw.Window) {
// get GLFW required vulkan extensions
glfwExtensions := window.GetRequiredInstanceExtensions()
if glfwExtensions == nil {
log.Println("Vulkan is not supported in this system")
panic("Vulkan is not supported in this system")
}
// add glfw required extensions to the slice of selected extensions
for _, extension := range glfwExtensions {
selectVulkanExtension(extension)
}
}
/* Returns a slice of strings where each string is the name of a selected and supported vulkan extension.
It requires the Vulkan api to be initialized.
*/
func getVulkanExtensions(selectedExtensions []string) []string {
// get supported extensions' count
var supportedExtensionCount uint32
result := vk.EnumerateInstanceExtensionProperties("", &supportedExtensionCount, nil)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan extensions count with error code %d\n", result)
return []string{}
}
// get supported extensions' properties
supportedExtensionProperties := make([]vk.ExtensionProperties, supportedExtensionCount)
result = vk.EnumerateInstanceExtensionProperties("", &supportedExtensionCount, supportedExtensionProperties)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan extensions with error code %d\n", result)
return []string{}
}
// get supported supportedExtensions' property name to slice of strings
supportedExtensions := make([]string, supportedExtensionCount)
for n, ext := range supportedExtensionProperties {
ext.Deref()
supportedExtensions[n] = vk.ToString(ext.ExtensionName[:])
}
// filter the selected extensions from the supported extensions
extensions := []string{}
for _, supportedExtension := range supportedExtensions {
// find extension in selected extensions
found := false
for _, selectedExtension := range selectedExtensions {
if selectedExtension == supportedExtension {
found = true
break
}
}
// add selected supported extension to the slice of extensions
if found {
extensions = append(extensions, supportedExtension)
}
}
// debug
if debug {
// log selected extensions
log.Print("Vulkan selected extensions:\n")
for _, extension := range selectedExtensions {
log.Printf(" %s\n", extension)
}
// log supported extensions
log.Print("Vulkan supported extensions:\n")
for _, extension := range supportedExtensions {
log.Printf(" %s\n", extension)
}
// log selected and supported extensions
log.Print("Vulkan selected and supported extensions:\n")
for _, extension := range extensions {
log.Printf(" %s\n", extension)
}
}
return extensions
}
/* Returns a pointer to the application info struct.
It requires the Vulkan api to be initialized.
*/
func getVulkanApplicationInfo() *vk.ApplicationInfo {
if vulkanApplicationInfo == nil {
// create the application info struct
vulkanApplicationInfo = new(vk.ApplicationInfo)
vulkanApplicationInfo.SType = vk.StructureTypeApplicationInfo
vulkanApplicationInfo.PNext = nil
vulkanApplicationInfo.PApplicationName = "OSIES"
vulkanApplicationInfo.ApplicationVersion = vk.MakeVersion(1, 0, 0)
vulkanApplicationInfo.PEngineName = "No Engine"
vulkanApplicationInfo.EngineVersion = vk.MakeVersion(1, 0, 0)
vulkanApplicationInfo.ApiVersion = vk.ApiVersion10
}
return vulkanApplicationInfo
}
/* Returns a pointer to the instance create info struct.
It requires the Vulkan api to be initialized.
*/
func getVulkanInstanceCreateInfo(window *glfw.Window) *vk.InstanceCreateInfo {
if vulkanCreateInstanceInfo == nil {
// get choosen and supported validation layers
vkLayers := []string{}
if debug {
selectVulkanValidationLayer("VK_LAYER_KHRONOS_validation")
vkLayers = getVulkanValidationLayers(vulkanSelectedValidationLayers)
selectVulkanExtension(vk.ExtDebugUtilsExtensionName)
selectVulkanExtension(vk.ExtDebugReportExtensionName)
}
// add GLFW required vulkan extensions to the slice of selected vulkan extensions
selectGLFWRequiredExtensions(window)
// get choosen and supported extensions
vkExtensions := getVulkanExtensions(vulkanSelectedExtensions)
// create the instance create info struct
vulkanCreateInstanceInfo = new(vk.InstanceCreateInfo)
vulkanCreateInstanceInfo.SType = vk.StructureTypeInstanceCreateInfo
vulkanCreateInstanceInfo.PNext = nil
vulkanCreateInstanceInfo.Flags = 0
vulkanCreateInstanceInfo.PApplicationInfo = getVulkanApplicationInfo()
vulkanCreateInstanceInfo.EnabledLayerCount = uint32(len(vkLayers))
vulkanCreateInstanceInfo.PpEnabledLayerNames = vkLayers
vulkanCreateInstanceInfo.EnabledExtensionCount = uint32(len(vkExtensions))
vulkanCreateInstanceInfo.PpEnabledExtensionNames = vkExtensions
}
return vulkanCreateInstanceInfo
}
/* Returns a slice of strings where each string is the name of a vulkan extension available on the current system.
It requires the Vulkan api to be initialized.
*/
func createVulkanInstance(window *glfw.Window) vk.Instance {
// create vulkan instance
var instance vk.Instance
result := vk.CreateInstance(getVulkanInstanceCreateInfo(window), nil, &instance)
if result != vk.Success {
log.Printf("Failed to create vulkan instance with error code %d\n", result)
panic("Failed to create vulkan instance")
}
return instance
}
/* Callback function to log vulkan debug messages.
It requires the Vulkan api to be initialized.
*/
var vulkanDebugCallback vk.DebugReportCallbackFunc = func(flags vk.DebugReportFlags, objectType vk.DebugReportObjectType, object uint64, location uint,
messageCode int32, layerPrefix string, message string, userData unsafe.Pointer) vk.Bool32 {
log.Printf("Vulkan: %s\n", message)
return vk.False
}
/* Returns a pointer to the debug report callback create info struct.
It requires the Vulkan api to be initialized.
*/
func getVulkanDebugReportCallbackCreateInfo() *vk.DebugReportCallbackCreateInfo {
if vulkanDebugReportCallbackCreateInfo == nil {
// create the application info struct
vulkanDebugReportCallbackCreateInfo = new(vk.DebugReportCallbackCreateInfo)
vulkanDebugReportCallbackCreateInfo.SType = vk.StructureTypeDebugReportCallbackCreateInfo
vulkanDebugReportCallbackCreateInfo.PNext = nil
vulkanDebugReportCallbackCreateInfo.Flags = vk.DebugReportFlags(vk.DebugReportPerformanceWarningBit | vk.DebugReportWarningBit | vk.DebugReportErrorBit)
vulkanDebugReportCallbackCreateInfo.PfnCallback = vulkanDebugCallback
vulkanDebugReportCallbackCreateInfo.PUserData = nil
}
return vulkanDebugReportCallbackCreateInfo
}
/* Crete and return a window surface.*/
func createVulkanSurface(instance vk.Instance, window *glfw.Window) vk.Surface {
surface, err := window.CreateWindowSurface(instance, nil)
if err != nil {
err := "Vulkan: failed to create a surface"
log.Println(err)
panic(err)
}
// vk.Surface(unsafe.Pointer(surface))
return (vk.Surface)(unsafe.Pointer(surface))
}
/* Finds and returns a slice of physical devices available on the system.*/
func getVulkanPhysicalDevices(instance vk.Instance) []vk.PhysicalDevice {
// get physical devices count
var deviceCount uint32
result := vk.EnumeratePhysicalDevices(instance, &deviceCount, nil)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan physical devices count with error code %d\n", result)
}
// get physical devices
devices := make([]vk.PhysicalDevice, deviceCount)
result = vk.EnumeratePhysicalDevices(instance, &deviceCount, devices)
if result != vk.Success {
log.Printf("VULKAN: Failed to retrieve vulkan physical devices with error code %d\n", result)
}
return devices
}
/* Filters physical devices that have the properties and features that our app needs.*/
func filterVulkanPropertiesAndFeaturesCompatiblePhysicalDevices(devices []vk.PhysicalDevice) []vk.PhysicalDevice {
supportedDevices := []vk.PhysicalDevice{}
// iterate devices
log.Print("Vulkan physical devices available:\n")
for _, device := range devices {
// get device properties
var deviceProperties vk.PhysicalDeviceProperties
vk.GetPhysicalDeviceProperties(device, &deviceProperties)
deviceProperties.Deref()
// log device
deviceName := string(bytes.Split(deviceProperties.DeviceName[:], []byte{0})[0])
log.Printf(" {name: %s, type: %d, apiVersion: %d, driverVersion: %d}\n", deviceName, deviceProperties.DeviceType, deviceProperties.ApiVersion, deviceProperties.DriverVersion)
// get device features
var deviceFeatures vk.PhysicalDeviceFeatures
vk.GetPhysicalDeviceFeatures(device, &deviceFeatures)
deviceFeatures.Deref()
// check if device is compatible
if deviceProperties.DeviceType == vk.PhysicalDeviceTypeDiscreteGpu &&
deviceFeatures.GeometryShader == vk.True {
supportedDevices = append(supportedDevices, device)
}
}
return supportedDevices
}
/* Finds and returns the first physical device that supports the queue families required by our app*/
func getVulkanQueueFamiliesCompatiblePhysicalDevice(devices []vk.PhysicalDevice, surface *vk.Surface) (vk.PhysicalDevice, map[string]uint32, error) {
// iterate devices
for _, device := range devices {
// get queue families' count
var queueFamiliesCount uint32
vk.GetPhysicalDeviceQueueFamilyProperties(device, &queueFamiliesCount, nil)
// get queue families
queueFamilies := make([]vk.QueueFamilyProperties, queueFamiliesCount)
vk.GetPhysicalDeviceQueueFamilyProperties(device, &queueFamiliesCount, queueFamilies)
// check if device supports all the required queue families
selectedQueueFamiliesIndices := map[string]uint32{}
var queueFlags vk.QueueFlags = vk.QueueFlags(vk.QueueGraphicsBit)
var queueCount uint32 = 1
var surfaceSupport vk.Bool32 = vk.False
for i, family := range queueFamilies {
family.Deref()
supportsGraphics := family.QueueFlags & queueFlags == queueFlags && family.QueueCount >= queueCount
supportsSurface := vk.GetPhysicalDeviceSurfaceSupport(device, uint32(i), *surface, &surfaceSupport) == vk.Success
// prefer a single queue family that supports all the requirements
if supportsGraphics && supportsSurface {
selectedQueueFamiliesIndices["graphics"] = uint32(i)
selectedQueueFamiliesIndices["surface"] = uint32(i)
break
}
// otherwise get multiple queue families
_, ok := selectedQueueFamiliesIndices["graphics"]
if !ok && supportsGraphics {
selectedQueueFamiliesIndices["graphics"] = uint32(i)
}
_, ok = selectedQueueFamiliesIndices["surface"]
if !ok && supportsSurface {
selectedQueueFamiliesIndices["surface"] = uint32(i)
}
}
// if the device supports all the required queue families exit early
if len(selectedQueueFamiliesIndices) == 2 {
return device, selectedQueueFamiliesIndices, nil
}
}
return nil, nil, errors.New("Vulkan: failed to find a physical device that supports the queue families required by this app")
}
/* Selects a physical device and queue family compatible with vulkan and the requirements of our app*/
func selectVulkanPhysicalDeviceAndQueueFamily(instance vk.Instance, surface *vk.Surface) (vk.PhysicalDevice, map[string]uint32) {
// get available devices
physicalDevices := getVulkanPhysicalDevices(instance)
if len(physicalDevices) < 1 {
err := "Vulkan: failed to find a device compatible with vulkan"
log.Println(err)
panic(err)
}
// filter devices with the properties and features required by our app
filteredPhysicalDevices := filterVulkanPropertiesAndFeaturesCompatiblePhysicalDevices(physicalDevices)
if len(filteredPhysicalDevices) < 1 {
err := "Vulkan: failed to find a device compatible with the properties and features required by our app"
log.Println(err)
panic(err)
}
// find the first device that supports the queue families required by our app
selectedPhysicalDevice, selectedQueueFamiliesIndices, err := getVulkanQueueFamiliesCompatiblePhysicalDevice(filteredPhysicalDevices, surface)
if err != nil {
err := "Vulkan: failed to find a device compatible that supports the queue families required by our app"
log.Println(err)
panic(err)
}
return selectedPhysicalDevice, selectedQueueFamiliesIndices
}
/* Returns a pointer to the device queue create info struct.*/
func getVulkanDeviceQueueCreateInfo(queueFamilyIndex uint32) *vk.DeviceQueueCreateInfo {
// create the device queue create info struct
deviceQueueCreateInfo := new(vk.DeviceQueueCreateInfo)
deviceQueueCreateInfo.SType = vk.StructureTypeDeviceQueueCreateInfo
deviceQueueCreateInfo.PNext = nil
deviceQueueCreateInfo.Flags = vk.DeviceQueueCreateFlags(0)
deviceQueueCreateInfo.QueueFamilyIndex = queueFamilyIndex
deviceQueueCreateInfo.QueueCount = 1
deviceQueueCreateInfo.PQueuePriorities = []float32{1.0}
return deviceQueueCreateInfo
}
/* Returns a pointer to the device queue create info struct.*/
func getPhysicalDeviceFeatures() *vk.PhysicalDeviceFeatures {
physicalDeviceFeatures := new(vk.PhysicalDeviceFeatures)
return physicalDeviceFeatures
}
/* Returns a pointer to the device queue create info struct.*/
func getVulkanDeviceCreateInfo(deviceQueueCreateInfos []vk.DeviceQueueCreateInfo, physicalDeviceFeatures vk.PhysicalDeviceFeatures) *vk.DeviceCreateInfo {
deviceCreateInfo := new(vk.DeviceCreateInfo)
deviceCreateInfo.SType = vk.StructureTypeDeviceCreateInfo
deviceCreateInfo.PNext = nil
deviceCreateInfo.Flags = vk.DeviceCreateFlags(0)
deviceCreateInfo.QueueCreateInfoCount = uint32(len(deviceQueueCreateInfos))
deviceCreateInfo.PQueueCreateInfos = deviceQueueCreateInfos
// these validation layers are device specific and ignored on modern implementations of vulkan
deviceCreateInfo.EnabledLayerCount = 0
deviceCreateInfo.PpEnabledLayerNames = []string{}
// These extensions are device specific
deviceCreateInfo.EnabledExtensionCount = 0
deviceCreateInfo.PpEnabledExtensionNames = []string{}
deviceCreateInfo.PEnabledFeatures = []vk.PhysicalDeviceFeatures{physicalDeviceFeatures}
return deviceCreateInfo
}
/* Creates and returns a vulkan logical device.*/
func createVulkanLogicalDevice(physicalDevice vk.PhysicalDevice, queueFamiliesIndices map[string]uint32) vk.Device {
// get slice of unique queue families indices
var uniqueQueueFamiliesIndices []uint32
for _, value := range queueFamiliesIndices {
isUnique := true
for _, index := range uniqueQueueFamiliesIndices {
if index == value {
isUnique = false
break
}
}
if isUnique {
uniqueQueueFamiliesIndices = append(uniqueQueueFamiliesIndices, value)
}
}
// get a slice of queue create info struct, one for each unique queue family
var deviceQueueCreateInfos []vk.DeviceQueueCreateInfo
for _, index := range uniqueQueueFamiliesIndices {
deviceQueueCreateInfos = append(deviceQueueCreateInfos, *getVulkanDeviceQueueCreateInfo(index))
}
// get physical device features struct
physicalDeviceFeatures := getPhysicalDeviceFeatures()
// get device create info struct
deviceCreateInfo := getVulkanDeviceCreateInfo(deviceQueueCreateInfos, *physicalDeviceFeatures)
// create the logical device
var logicalDevice vk.Device
result := vk.CreateDevice(physicalDevice, deviceCreateInfo, nil, &logicalDevice)
if result != vk.Success {
err := fmt.Sprintf("Vulkan: failed to create logical device with error code %d\n", result)
log.Println(err)
panic(err)
}
return logicalDevice
}
那么 glfw 中的 createwindowsurface 在 vulkan-go 中如何工作?
正确答案
在 vulkan-go 中,GLFW 的 CreateWindowSurface 返回一个指向 vk.Surface 的 unsafe.Pointer 的 uintptr,因此要将其获取到 vk.Surface,我们需要:
- 将 uintptr 转换为 unsafe.Pointer
unsafe.Pointer(surface); - 然后将生成的 unsafe.Pointer 类型转换为 vk.Surface 指针
(*vk.Surface)(unsafe.Pointer(surface)); - 最后抓住 vk.Surface 的指针指向
*(*vk.Surface)(unsafe.Pointer(surface))的内容。
我们不能将指针类型转换为数据类型,我们要么将指针类型转换为我们想要的数据类型的指针,然后获取这个新指针所指向的内容,或者我们首先获取该指针所指向的内容,然后type 将其转换为我们想要的数据类型。
今天关于《vulkan-go 中如何利用GLFW中的CreateWindowSurface函数?》的内容介绍就到此结束,如果有什么疑问或者建议,可以在golang学习网公众号下多多回复交流;文中若有不正之处,也希望回复留言以告知!
解读Go语言学习的关键知识点
- 上一篇
- 解读Go语言学习的关键知识点
- 下一篇
- 深入探究MyBatis缓存机制:从一级到二级缓存
-
- Golang · Go问答 | 1年前 |
- 在读取缓冲通道中的内容之前退出
- 139浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 戈兰岛的全球 GOPRIVATE 设置
- 204浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将结构作为参数传递给 xml-rpc
- 325浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何用golang获得小数点以下两位长度?
- 478浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何通过 client-go 和 golang 检索 Kubernetes 指标
- 486浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将多个“参数”映射到单个可变参数的习惯用法
- 439浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将 HTTP 响应正文写入文件后出现 EOF 错误
- 357浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 结构中映射的匿名列表的“复合文字中缺少类型”
- 352浏览 收藏
-
- Golang · Go问答 | 1年前 |
- NATS Jetstream 的性能
- 101浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将复杂的字符串输入转换为mapstring?
- 440浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 相当于GoLang中Java将Object作为方法参数传递
- 212浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何确保所有 goroutine 在没有 time.Sleep 的情况下终止?
- 143浏览 收藏
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 543次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 516次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 500次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 485次学习
-
- ChatExcel酷表
- ChatExcel酷表是由北京大学团队打造的Excel聊天机器人,用自然语言操控表格,简化数据处理,告别繁琐操作,提升工作效率!适用于学生、上班族及政府人员。
- 3190次使用
-
- Any绘本
- 探索Any绘本(anypicturebook.com/zh),一款开源免费的AI绘本创作工具,基于Google Gemini与Flux AI模型,让您轻松创作个性化绘本。适用于家庭、教育、创作等多种场景,零门槛,高自由度,技术透明,本地可控。
- 3402次使用
-
- 可赞AI
- 可赞AI,AI驱动的办公可视化智能工具,助您轻松实现文本与可视化元素高效转化。无论是智能文档生成、多格式文本解析,还是一键生成专业图表、脑图、知识卡片,可赞AI都能让信息处理更清晰高效。覆盖数据汇报、会议纪要、内容营销等全场景,大幅提升办公效率,降低专业门槛,是您提升工作效率的得力助手。
- 3433次使用
-
- 星月写作
- 星月写作是国内首款聚焦中文网络小说创作的AI辅助工具,解决网文作者从构思到变现的全流程痛点。AI扫榜、专属模板、全链路适配,助力新人快速上手,资深作者效率倍增。
- 4540次使用
-
- MagicLight
- MagicLight.ai是全球首款叙事驱动型AI动画视频创作平台,专注于解决从故事想法到完整动画的全流程痛点。它通过自研AI模型,保障角色、风格、场景高度一致性,让零动画经验者也能高效产出专业级叙事内容。广泛适用于独立创作者、动画工作室、教育机构及企业营销,助您轻松实现创意落地与商业化。
- 3811次使用
-
- GoLand调式动态执行代码
- 2023-01-13 502浏览
-
- 用Nginx反向代理部署go写的网站。
- 2023-01-17 502浏览
-
- Golang取得代码运行时间的问题
- 2023-02-24 501浏览
-
- 请问 go 代码如何实现在代码改动后不需要Ctrl+c,然后重新 go run *.go 文件?
- 2023-01-08 501浏览
-
- 如何从同一个 io.Reader 读取多次
- 2023-04-11 501浏览

