You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: chinese.go
    path of file: ./repos/scan4all/vendor/github.com/lcvvvv/gonmap/lib/chinese
    
    the code of the file until where you have to start completion: package chinese

import (
	"golang.org/x/text/encoding/simplifiedchinese"
	"unicode/utf8"
)

func ByteToGBK(strBuf []byte) []byte {
	if isUtf8(strBuf) {
		if GBKBuf, err := simplifiedchinese.GBK.NewEncoder().Bytes(strBuf); err == nil {
			if isUtf8(GBKBuf) == false {
				return GBKBuf
			}
		}
		if GB18030Buf, err := simplified
    
func ByteToGBK(strBuf []byte) []byte {
	if isUtf8(strBuf) {
		if GBKBuf, err := simplifiedchinese.GBK.NewEncoder().Bytes(strBuf); err == nil {
			if isUtf8(GBKBuf) == false {
				return GBKBuf
			}
		}
		if GB18030Buf, err := simplifiedchinese.GB18030.NewEncoder().Bytes(strBuf); err == nil {
			if isUtf8(GB18030Buf) == false {
				return GB18030Buf
			}
		}
		return strBuf
	} else {
		return strBuf
	}
}