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: tkv_etcd.go
    path of file: ./repos/juicefs/pkg/meta
    
    the code of the file until where you have to start completion: //go:build !noetcd
// +build !noetcd

/*
 * JuiceFS, Copyright 2022 Juicedata, 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/LICE
    
func (tx *etcdTxn) commmit() error {
	start := time.Now()
	var conds []etcd.Cmp
	var ops []etcd.Op
	for k, v := range tx.observed {
		conds = append(conds, etcd.Compare(etcd.ModRevision(k), "=", v))
	}
	for k, v := range tx.buffer {
		var op etcd.Op
		if v == nil {
			op = etcd.OpDelete(string(k))
		} else {
			op = etcd.OpPut(string(k), string(v))
		}
		ops = append(ops, op)
	}
	resp, err := tx.kv.Txn(tx.ctx).If(conds...).Then(ops...).Commit()
	if time.Since(start) > time.Millisecond*10 {
		logger.Debugf("txn with %d conds and %d ops took %s", len(conds), len(ops), time.Since(start))
	}
	if err != nil {
		return err
	}
	if resp.Succeeded {
		return nil
	}
	return conflicted
}