The error message indicates that the variable 'parse' of type UUID cannot be used as a type []byte.

To fix this issue, you need to convert the 'parse' variable of type UUID to a []byte before passing it to the LookupNetworkByUUID function. Here's an example of how you can do this:

parse, err := uuid2.Parse(req.NetworkUUId)
if err != nil {
    logger.Error(err.Error())
    return "", err
}

// Convert parse to []byte
uuidBytes := parse.Bytes()

network, err := srv.cli.LookupNetworkByUUID(uuidBytes)
if err != nil {
    logger.Error(err.Error())
    return "", err
}

By calling the Bytes() method on the 'parse' variable, it will return the UUID as a []byte, which can then be passed to the LookupNetworkByUUID function.

parse err = uuid2ParsereqNetworkUUId	if err != nil		loggerErrorerrError		return err		network err = srvcliLookupNetworkByUUIDparse	if err != nil 		loggerErrorerrError		return err	报错:Cannot use parse

原文地址: https://www.cveoy.top/t/topic/iD5f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录