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: info.go
    path of file: ./repos/delve/pkg/dwarf/dwarfbuilder
    
    the code of the file until where you have to start completion: package dwarfbuilder

import (
	"bytes"
	"debug/dwarf"
	"encoding/binary"

	"github.com/go-delve/de
    
func (b *Builder) Attr(attr dwarf.Attr, val interface{}) dwarf.Offset {
	if len(b.tagStack) == 0 {
		panic("Attr with no open tags")
	}
	off := dwarf.Offset(b.info.Len())
	tag := b.tagStack[len(b.tagStack)-1]
	if tag.children {
		panic("Can't add attributes after adding children")
	}

	tag.attr = append(tag.attr, attr)

	switch x := val.(type) {
	case string:
		tag.form = append(tag.form, DW_FORM_string)
		b.info.Write([]byte(x))
		b.info.WriteByte(0)
	case uint8:
		tag.form = append(tag.form, DW_FORM_data1)
		binary.Write(&b.info, binary.LittleEndian, x)
	case uint16:
		tag.form = append(tag.form, DW_FORM_data2)
		binary.Write(&b.info, binary.LittleEndian, x)
	case uint64:
		tag.form = append(tag.form, DW_FORM_data8)
		binary.Write(&b.info, binary.LittleEndian, x)
	case Address:
		tag.form = append(tag.form, DW_FORM_addr)
		binary.Write(&b.info, binary.LittleEndian, x)
	case dwarf.Offset:
		tag.form = append(tag.form, DW_FORM_ref_addr)
		binary.Write(&b.info, binary.LittleEndian, x)
	case []byte:
		tag.form = append(tag.form, DW_FORM_block4)
		binary.Write(&b.info, binary.LittleEndian, uint32(len(x)))
		b.info.Write(x)
	case []LocEntry:
		tag.form = append(tag.form, DW_FORM_sec_offset)
		binary.Write(&b.info, binary.LittleEndian, uint32(b.loc.Len()))

		// base address
		binary.Write(&b.loc, binary.LittleEndian, ^uint64(0))
		binary.Write(&b.loc, binary.LittleEndian, uint64(0))

		for _, locentry := range x {
			binary.Write(&b.loc, binary.LittleEndian, locentry.Lowpc)
			binary.Write(&b.loc, binary.LittleEndian, locentry.Highpc)
			binary.Write(&b.loc, binary.LittleEndian, uint16(len(locentry.Loc)))
			b.loc.Write(locentry.Loc)
		}

		// end of loclist
		binary.Write(&b.loc, binary.LittleEndian, uint64(0))
		binary.Write(&b.loc, binary.LittleEndian, uint64(0))
	default:
		panic("unknown value type")
	}

	return off
}