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: scanner.go
    path of file: ./repos/gotosocial/vendor/github.com/go-swagger/go-swagger/scan
    
    the code of the file until where you have to start completion: //go:build !go1.11
// +build !go1.11

// Copyright 2015 go-swagger maintainers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

    
func (sp *yamlSpecScanner) UnmarshalSpec(u func([]byte) error) (err error) {
	spec := cleanupScannerLines(sp.yamlSpec, rxUncommentYAML, nil)
	if len(spec) == 0 {
		return errors.New("no spec available to unmarshal")
	}

	if !strings.Contains(spec[0], "---") {
		return errors.New("yaml spec has to start with `---`")
	}

	// remove indentation
	spec = removeIndent(spec)

	// 1. parse yaml lines
	yamlValue := make(map[interface{}]interface{})

	yamlContent := strings.Join(spec, "\n")
	err = yaml.Unmarshal([]byte(yamlContent), &yamlValue)
	if err != nil {
		return
	}

	// 2. convert to json
	var jsonValue json.RawMessage
	jsonValue, err = fmts.YAMLToJSON(yamlValue)
	if err != nil {
		return
	}

	// 3. unmarshal the json into an interface
	var data []byte
	data, err = jsonValue.MarshalJSON()
	if err != nil {
		return
	}
	err = u(data)
	if err != nil {
		return
	}

	// all parsed, returning...
	sp.yamlSpec = nil // spec is now consumed, so let's erase the parsed lines
	return
}