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: bazel_test.go
    path of file: ./repos/rules_go/go/tools/bazel
    
    the code of the file until where you have to start completion: // Copyright 2017 Google Inc.
//
// 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
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o
    
func makeAndEnterTempdir() (func(), error) {
	oldCwd, err := os.Getwd()
	if err != nil {
		return nil, fmt.Errorf("cannot get path to current directory: %v", err)
	}

	tempDir, err := ioutil.TempDir("", "test")
	if err != nil {
		return nil, fmt.Errorf("failed to create temporary directory: %v", err)
	}

	err = os.Chdir(tempDir)
	if err != nil {
		os.RemoveAll(tempDir)
		return nil, fmt.Errorf("cannot enter temporary directory %s: %v", tempDir, err)
	}

	cleanup := func() {
		defer os.RemoveAll(tempDir)
		defer os.Chdir(oldCwd)
	}
	return cleanup, nil
}